public override string DoAction(EidosPart target) { if (target.HP.Current < target.HP.Max) { if (target.HP.Current <= target.HP.Max - (int)ActionValues[0]) { target.HP.Current += (int)ActionValues[0]; return string.Format("{0} recovered {1}, current HP: {2}", target.Name, (int)ActionValues[0], target.HP.Current); } else { target.HP.Current = target.HP.Max; return string.Format("{0}, current HP: {0}",target.Name, target.HP.Current); } } return string.Format("{0}, current HP: {0}",target.Name, target.HP.Current); }
public override string DoAction(EidosPart targetPart) { Eidos target = targetPart.Target; List<string> repaired = new List<string>(); string result = string.Empty; using (RNG rand = new RNG()) { foreach (EidosPart part in target.Parts.Where(f => f.IsDestroyed)) if (rand.d100() > 50) { result = part.Repair((int)ActionValues[0]); repaired.Add(part.Name + (!string.IsNullOrEmpty(result) ? string.Format(" ({0} HPs)", result) : string.Empty)); } } if (target is Ship) { result = string.Format("Repaired {0} for {1} HPs", target.Name, ((Ship)target).HP.Add((int)ActionValues[0]).ToString()); if (repaired.Count > 0) result = result + string.Format(", and Repaired {0}", string.Join(", ", repaired.ToArray())); } else result = string.Format("Repaired {0}", string.Join(", ", repaired.ToArray())); return result; }