public ApplyEffect ( Combatant, user, Combatant, target ) : bool | ||
user | Combatant, | |
target | Combatant, | |
Résultat | bool |
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;
}
public void ApplyEffect() { if (effect == null) { statusIcon.HideIcon(); Debug.LogError("effect is not defined"); return; } effect.ApplyEffect(); duration--; if (statusIcon == null) { Debug.LogError("No icon setup for " + effect.name); //SetIcon(CBT.EnableIconDynamically(effect)); return; } statusIcon.SetInfo(this); //redundant? if (IsFinished()) { statusIcon.HideIcon(); return; } }