Beispiel #1
0
    public int ChangeValue(int statusID, int elementID, Combatant user, Combatant target, 
			bool showNumber, float damageFactor, float damageMultiplier)
    {
        int change = 0;
        if(this.active)
        {
            if(this.blockable && DataHolder.GameSettings().GetRandom() <=
                (DataHolder.Formulas().formula[target.baseBlock].Calculate(user, target) + target.GetBlockBonus()))
            {
                DataHolder.BattleSystemData().blockTextSettings.ShowText("", target);
            }
            else
            {
                change = this.GetChange(user, target, damageFactor, damageMultiplier);
                int oldValue = target.status[statusID].GetValue();

                // set the new value to the target status
                if(this.IsAdd())
                {
                    if(target.status[statusID].IsNormal())
                    {
                        target.status[statusID].AddBaseValue(change);
                        target.status[statusID].AddValue(change, false, false, showNumber);
                    }
                    else
                    {
                        if(change < 0)
                        {
                            change = this.GetDefendedChange(change, elementID, user, target);
                        }
                        target.status[statusID].AddValue(change, false, false, showNumber);
                    }
                }
                else if(this.IsSub())
                {
                    if(target.status[statusID].IsNormal())
                    {
                        target.status[statusID].AddBaseValue(-change);
                        target.status[statusID].AddValue(-change, false, false, showNumber);
                    }
                    else
                    {
                        if(change > 0)
                        {
                            change = this.GetDefendedChange(change, elementID, user, target);
                        }
                        target.status[statusID].AddValue(-change, false, false, showNumber);
                    }
                }
                else if(this.IsSet())
                {
                    if(target.status[statusID].IsNormal())
                    {
                        target.status[statusID].SetBaseValue(change);
                        target.status[statusID].SetValue(change, false, false, showNumber);
                    }
                    else
                    {
                        target.status[statusID].SetValue(change, false, false, showNumber);
                    }
                }
                for(int j=0; j<target.status.Length; j++) target.status[j].CheckBounds();
                // set aggressive if attacked
                if(target.status[statusID].IsConsumable() &&
                    target.status[statusID].GetValue() < oldValue)
                {
                    target.CheckAggressive(AggressiveType.DAMAGE);
                }
                // cancel skills
                if(this.cancelSkills)
                {
                    target.CancelSkillCast();
                }
            }
        }
        return change;
    }