Beispiel #1
0
    public Actor(int maxHp, int armor, int defence, string image, string element)
    {
        this._maxHp        = new ListenableProperty <int>(maxHp);
        this._armor        = new ListenableProperty <int>(armor);
        this._defence      = new ListenableProperty <int>(defence);
        this._healthPoint  = new ListenableRangeProperty <int>(maxHp, maxHp, 0);
        this._frozen       = new ListenableProperty <bool>(false);
        this._alive        = new ListenableProperty <bool>(true);
        this._attackEnable = new ListenableProperty <bool>(true);
        this._focusAble    = new ListenableProperty <bool>(true);

        this._buffList = new FilteredListenableList <IBuff>();
        this._image    = new ListenableProperty <string>(image);
        this._element  = new ListenableProperty <string>(element);

        this._turnStartListeners = new ListenableList <IActorTurnStartListener>();

        this._attackDecoratorList      = new ListenableList <IStrategyDecorator <AttackInfo> >();
        this._underAttackDecoratorList = new ListenableList <IStrategyDecorator <AttackInfo> >();

        this._buffList.SetSorting(new IBuffComparator());
        this._attackDecoratorList.SetSorting(new IDecoratorComparator());
        this._underAttackDecoratorList.SetSorting(new IDecoratorComparator());
        this._turnStartListeners.SetSorting(new ITurnStartListenerComparator());
    }
Beispiel #2
0
 // 當HP被限制時
 public void OnLimited(ListenableRangeProperty <int> property, int original, int final, int max, int min)
 {
     if (original > final)
     {
         // increase armor
         this._actor.Armor.Property += (original - final);
     }
 }