示例#1
0
    public bool ApplyEffect(Combatant user, Combatant target)
    {
        bool applied = false;
        if(target.CanApplyEffect(this.realID) &&
                (!this.hitChance ||
                DataHolder.GameSettings().GetRandom() <= DataHolder.Formulas().formula[this.hitFormula].Calculate(user, target)))
        {
            for(int i=0; i<this.condition.Length; i++)
            {
                if(this.condition[i].apply && !this.condition[i].stopChange)
                {
                    this.condition[i].InitChange(i, target);
                    if(this.condition[i].OnCast())
                    {
                        this.condition[i].SetChange(i, target);
                    }
                }
            }

            if(StatusEffectEnd.TIME.Equals(this.end)) this.endAfter = this.endValue*1000;
            else this.endAfter = this.endValue;
            this.combatant = target;
            applied = true;
            this.initialized = true;
        }
        return applied;
    }