カスタムFeat
カスタムFeatクラスは Feat から継承する必要があります。
cs
internal class FeatMyExample: FeatElin はすべてのFeat効果を Feat.Apply メソッドに記述しているため、CWL はイベント _OnApply を提供しています。これは、Featクラス内でオプションのイベントハンドラー _OnApply を定義することで、自分のFeat効果を適用することができます:
cs
internal class FeatMyExample : Feat
{
internal void _OnApply(int add, ElementContainer eleOwner, bool hint)
{
if (hint) {
hints.Add("This is a custom feat"); // 任意(オプション)
} else {
// 属性の変更、ポテンシャルの設定、効果の適用などを行う
// hint モードではない場合のみ実行する
eleOwner.ModBase(SKILL.life, add * 15);
eleOwner.ModPotential(SKILL.DEX, add * 2);
// その他
}
}
}これには CustomWhateverLoader.dll の参照は必要ありません。
カスタムFeatはカスタムアイコンを持つこともでき、要素アイコンは Texture フォルダーに配置する必要があります。ファイル名は alias と同じにする必要があり、例えば featMyExample.png です。その後、GetIcon メソッドをオーバーライドして、アイコンを自分のアイコンにリダイレクトする必要があります:
cs
internal class FeatMyExample : Feat
{
public override Sprite GetIcon(string suffix = "")
{
return SpriteSheet.Get(source.alias);
}
}テクスチャのサイズが32x32でない場合、CWLはそれを32x32に調整します。
タグ addEleOnLoad を使用すると、プレイヤーはロード時に自動的にこのFeatを取得します。
