public void AddBuff(Effects.Buff _buff) { foreach (Effects.Buff _buff_name in _buffs) { if (_buff_name.Name == _buff.Name) { _buff_name.turnsLeft = _buff.turnsLeft; return; } } var _new_buff = new Effects.Buff(); _new_buff.Name = _buff.Name; foreach (Effects.BuffEffect stat in _buff.stats) { var _new_stat = new Effects.BuffEffect(); _new_stat.stat = stat.stat; _new_stat.power = stat.power; _new_buff.stats.Add(_new_stat); } _new_buff.turnsLeft = _buff.turnsLeft; for (int i = 0; i < _buffs.Length; i++) { if (_buffs[i].Name == "") { _buffs[i] = (_new_buff); ApplyBuff(_new_buff, 1); AddStatText(_new_buff.Name, i); break; } } }
public void ApplyBuff(Effects.Buff buff, int add) { if (buff.Name == "" || buff.Name == null) { return; } foreach (Effects.BuffEffect effect in buff.stats) { switch (effect.stat) { case BuffEffects.strenght: strenght += effect.power * add; break; case BuffEffects.intellect: intellect += effect.power * add; break; case BuffEffects.defence: defence += effect.power * add; break; case BuffEffects.resistance: resistance += effect.power * add; break; } } Debug.Log(buff.Name); }
public void ApplyBuff(Effects.Buff buff, int add) { if (buff.Name == null || buff.Name == "") { return; } foreach (Effects.BuffEffect effect in buff.stats) { switch (effect.stat) { case BuffEffects.strenght: strenght += effect.power * add; break; case BuffEffects.intellect: intellect += effect.power * add; break; case BuffEffects.defence: defence += effect.power * add; break; case BuffEffects.resistance: resistance += effect.power * add; break; case BuffEffects.Fire: if (fire == Effectiveness.absorb || (fire == Effectiveness.immun && effect.power < 2)) { break; } else { SetElementalBuff(Element.Fire, effect.power, add); break; } case BuffEffects.Ice: if (ice == Effectiveness.absorb || (ice == Effectiveness.immun && effect.power < 2)) { break; } else { SetElementalBuff(Element.Ice, effect.power, add); break; } case BuffEffects.Thunder: if (thunder == Effectiveness.absorb || (thunder == Effectiveness.immun && effect.power < 2)) { break; } else { SetElementalBuff(Element.Thunder, effect.power, add); break; } } } Debug.Log(buff.Name); }