/// <summary> /// Adds a new member to the team. /// </summary> /// <param name="companion">The Character object to add.</param> /// <returns>Fires event each time a companion is added.</returns> public void AddCompanion(Friend companion) { if (companion is IMagician) { foreach (IFriend member in this.companions) { member.BattleStrength *= (companion as IMagician).SpellPower; } } this.companions.Add(companion); string message = string.Format("{0} just joined the team. Your strength has now increased to {1:0.00}.", companion.Name, this.Strength); FriendJoinedTheTeamEventArgs joinedEventArgs = new FriendJoinedTheTeamEventArgs(companion, message); FriendJoinedTheTeam(companion, joinedEventArgs); }
private void FriendJoined(Friend aFriend, FriendJoinedTheTeamEventArgs eventArgs) { this.joinInTeamMessage += "\n" + eventArgs.Message; }