public override IUnit Clone() { ICanBeDublacate dubl = Unit as ICanBeDublacate; ArmorUnitHelmet AUS = new ArmorUnitHelmet(dubl.Clone()); return(AUS); }
public string DoAbility(List <IUnit> Allies, List <IUnit> Enemies, int position) { string AbilityResult = "Mage at position " + position; for (int i = Range; i > -Range; i--) { if (Allies.Count >= (position + i) || position + i < 0) { continue; } if (Allies[position + i] is ICanBeDublacate) { ICanBeDublacate CloneUnit = Allies[position + i] as ICanBeDublacate; Random random = new Random(); int Chance = random.Next(1, 21); if (Chance == 20) { Allies.Insert(position - 1, CloneUnit.Clone()); AbilityResult += string.Format(" cloned the {0} at position {1}\n", Allies[position + i].Name, position + i); return(AbilityResult); } } } return(AbilityResult + string.Format(" can't clone\n")); }