public static Buff CreateBuffFrom(Buff buff, Dictionary <Hero, Hero> heroMap) { Assert.IsNotNull(buff); switch (buff.GetBuffType()) { case BuffType.SoldierBuff: { SoliderAttackBuff res = new SoliderAttackBuff(); res.DeepCopy(buff, heroMap); return(res); } case BuffType.FireBuff: { FireBuff res = new FireBuff(0, null); res.DeepCopy(buff, heroMap); return(res); } default: break; } ; Buff fres = new Buff(); fres.DeepCopy(buff, heroMap); return(fres); }
public override bool DoRecieveDamage(ref Damage dmgs) { if (!dmgs.IsHeal) { SoliderAttackBuff buff = null; if (parent.GetHeroInfo().GetBuff <SoliderAttackBuff>() != null) { buff = (SoliderAttackBuff)parent.GetHeroInfo().GetBuff <SoliderAttackBuff>(); } if (buff == null) { buff = new SoliderAttackBuff(); Debug.Log("Add Solider buff"); parent.GetHeroInfo().AddBuff(buff); } buff.AddUpBuff(attackIncrease); return(true); } return(false); }