internal void BroadcastSkillEffect_LogUpdate(PlayerIndicator player, List <CardModel> targets, CardSkill skill) { #if UNITY_EDITOR || DEVELOPMENT_BUILD if (skill == null) { throw new ArgumentNullException("skill", "Skill argument cannot be null in this context."); } #endif if (targets == null || targets.Count == 0) { return; } // a bit of a hack CardModel dummy = new CardModel(0, PlayerIndicator.Bot); skill.Effect(dummy); // see what this spell does to a dummy bool heals = dummy.CurrentStrength > dummy.DefaultStrength; // true - heals, false - damages int howPowerful = Math.Abs(dummy.DefaultStrength - dummy.CurrentStrength); string lastExecutedCommand = $"<b>{CurrentPlayer.ToString()} Player's</b> card "; lastExecutedCommand += targets.Count == 1 ? $"{HealsOrDamages()} <color=yellow>{DB[targets[0].CardId].Title}</color> for {howPowerful} point(s)" : $"{HealsOrDamages()} following cards: " + string.Join(", ", targets) // many targets + $" for total of {howPowerful * targets.Count} point(s)"; string HealsOrDamages() => heals ? "<color=green>heals</color>" : "<color=red>damages</color>"; GameLogicLogUpdateEventHandler?.Invoke( this, new GameLogicLogUpdateEventArgs( player, GetCurrentStatus(), lastExecutedCommand, TopTotalStrength, BotTotalStrength)); }
internal void BroadcastCardMove_LogUpdate(PlayerIndicator player, MoveData move) { #if UNITY_EDITOR || DEVELOPMENT_BUILD if (move == null) { throw new ArgumentNullException("move", "Move argument cannot be null in this context."); } #endif string cardTitle = DB[move.Card.CardId].Title; string lastExecutedCommand = $"<b>Player {player.ToString()}</b> moved card <color=yellow>{cardTitle}</color> " + $"from <b>{move.FromLine.ToString()}</b> slot <b>{move.FromSlotNumber}</b> " + $"to <b>{move.TargetLine.ToString()}</b> slot <b>{move.TargetSlotNumber}</b>"; GameLogicLogUpdateEventHandler?.Invoke( this, new GameLogicLogUpdateEventArgs( player, GetCurrentStatus(), lastExecutedCommand, TopTotalStrength, BotTotalStrength)); }