Ejemplo n.º 1
0
        //public override CombatResult Resolve(CombatMove OpponentMove)
        //{
        //    return base.Resolve(OpponentMove);
        //}

        /// <summary>
        /// This Fighter BLOCKS, Opponent Fighter BLOCKS
        /// If either false blocked previously then
        /// cant block next turn
        /// </summary>
        /// <param name="thisFighterId"></param>
        /// <param name="opponentFighterId"></param>
        /// <returns></returns>
        protected override CombatResult resolve(List <CombatMove> Moves)
        {
            string thisFighterId     = Moves[0].FighterId;
            string opponentFighterId = Moves[1].FighterId;

            CombatResult combatResult = new CombatResult();
            string       comments     = "Both knights block.";

            //ICombatHistoryResolver successfulBlockHistoryResolver = new SuccessfulBlockHistoryResolver(_combatSession);
            ICombatHistoryResolver falseBlockHistoryResolver = new FalseBlockHistoryResolver(_combatSession);

            //int numTimesThisFighterHasBeenBlocked = numberPreviousSuccessfulBlocks(opponentFighterId, thisFighterId);
            //int numTimesOpponentFighterHasBeenBlocked = numberPreviousSuccessfulBlocks(thisFighterId, opponentFighterId);
            //int numTimesThisFighterHasBeenBlocked = numberPreviousSuccessfulBlocks(opponentFighterId);
            //int numTimesOpponentFighterHasBeenBlocked = numberPreviousSuccessfulBlocks(thisFighterId);
            int numTimesThisFighterHasFalseBlocked     = falseBlockHistoryResolver.Resolve(thisFighterId);
            int numTimesOpponentFighterHasFalseBlocked = falseBlockHistoryResolver.Resolve(opponentFighterId);

            //combatResult.CombatAnimationInstructions[thisFighterId].AnimCommand = AnimationCommands.AC_BLOCK;
            //combatResult.CombatAnimationInstructions[opponentFighterId].AnimCommand = AnimationCommands.AC_BLOCK;
            combatResult.CombatAnimationInstructions.Add(thisFighterId,
                                                         new CombatAnimationInstruction()
            {
                FighterID = thisFighterId, AnimCommand = AnimationCommands.AC_BLOCK
            });
            combatResult.CombatAnimationInstructions.Add(opponentFighterId,
                                                         new CombatAnimationInstruction()
            {
                FighterID = opponentFighterId, AnimCommand = AnimationCommands.AC_BLOCK
            });

            if (numTimesThisFighterHasFalseBlocked > 0)
            {
                comments = comments + string.Format(" {0} false blocked previoulsy, cannot block next turn. ", thisFighterId);
                //combatResult.ShieldTaunt.Add(opponentFighterId);
                //This Fighter cant block next turn
                combatResult.MoveRestrictions.Add(new KeyValuePair <string, CombatActions>(thisFighterId, CombatActions.BLOCK));
                //So Opponent Fighter cant swing either
                //combatResult.MoveRestrictions.Add(new KeyValuePair<string, CombatActions>(opponentFighterId, CombatActions.SWING));
            }

            if (numTimesOpponentFighterHasFalseBlocked > 0)
            {
                comments = comments + string.Format(" {0} false blocked previoulsy, cannot block next turn. ", opponentFighterId);
                //combatResult.ShieldTaunt.Add(thisFighterId);
                //Opponent Fighter cant block next turn
                combatResult.MoveRestrictions.Add(new KeyValuePair <string, CombatActions>(opponentFighterId, CombatActions.BLOCK));
                //So This Fighter cant block either
                //combatResult.MoveRestrictions.Add(new KeyValuePair<string, CombatActions>(thisFighterId, CombatActions.BLOCK));
            }

            //combatResult.TotalRunningHPs[thisFighterId] = totalHPs(thisFighterId);
            //combatResult.TotalRunningHPs[opponentFighterId] = totalHPs(opponentFighterId);
            combatResult.TotalRunningHPs.Add(thisFighterId, totalHPs(thisFighterId));
            combatResult.TotalRunningHPs.Add(opponentFighterId, totalHPs(opponentFighterId));

            combatResult.Comments = comments;

            return(combatResult);
        }
Ejemplo n.º 2
0
        //public override CombatResult Resolve(CombatMove OpponentMove)
        //{
        //    return base.Resolve(OpponentMove);
        //}

        /// <summary>
        /// This Fighter BLOCKS, Opponent Fighter RESTS
        /// If This Fighter false blocked previously then
        /// cant block next turn.
        /// Opponent Fighter heals
        /// </summary>
        /// <param name="thisFighterId"></param>
        /// <param name="opponentFighterId"></param>
        /// <returns></returns>
        protected override CombatResult resolve(List <CombatMove> Moves)
        {
            string blockingFighterId = Moves.Where(x => x.Action == CombatActions.BLOCK).FirstOrDefault().FighterId;
            string restingFighterId  = Moves.Where(x => x.Action == CombatActions.REST).FirstOrDefault().FighterId;

            CombatResult combatResult = new CombatResult();
            string       comments     = "Player heals.";

            ICombatHistoryResolver falseBlockHistoryResolver = new FalseBlockHistoryResolver(_combatSession);

            //get count of how may times This Fighter has been previously false blocked
            //int previousFalseBlocks = numberPreviousFalseBlocks(thisFighterId, opponentFighterId);
            //int previousFalseBlocks = numberPreviousFalseBlocks(thisFighterId);
            int previousFalseBlocks = falseBlockHistoryResolver.Resolve(blockingFighterId);

            if (previousFalseBlocks > 0)
            {
                combatResult.MoveRestrictions.Add(new KeyValuePair <string, CombatActions>(blockingFighterId, CombatActions.BLOCK));
                comments = string.Format("{0} false blocks and cannot block next turn", blockingFighterId);
            }

            //get count of how may times Opponent Fighter has previously healed
            //int previousHeals = numberPreviousSuccessfulHeals(opponentFighterId, thisFighterId);
            //int previousHeals = numberPreviousSuccessfulHeals(opponentFighterId);
            SuccessfulHealHistoryResolver successfulHealHistoryResolver = new SuccessfulHealHistoryResolver(_combatSession);
            int previousHeals = successfulHealHistoryResolver.Resolve(restingFighterId);

            //combatResult.CombatAnimationInstructions[thisFighterId].AnimCommand = AnimationCommands.AC_BLOCK;
            //combatResult.CombatAnimationInstructions[opponentFighterId].AnimCommand = AnimationCommands.AC_HEAL;
            combatResult.CombatAnimationInstructions.Add(blockingFighterId, new CombatAnimationInstruction()
            {
                FighterID = blockingFighterId, AnimCommand = AnimationCommands.AC_BLOCK
            });
            combatResult.CombatAnimationInstructions.Add(restingFighterId, new CombatAnimationInstruction()
            {
                FighterID = restingFighterId, AnimCommand = AnimationCommands.AC_HEAL
            });


            //damage is base 2 plus previous consecutive hits
            int totalHealing = 1 + previousHeals;

            //combatResult.HPAdjustments[opponentFighterId] = totalHealing;
            combatResult.HPAdjustments.Add(restingFighterId, totalHealing);

            //combatResult.TotalRunningHPs[opponentFighterId] = totalHPs(opponentFighterId) + totalHealing;
            //combatResult.TotalRunningHPs[thisFighterId] = totalHPs(thisFighterId);
            combatResult.TotalRunningHPs.Add(restingFighterId, totalHPs(restingFighterId) + totalHealing);
            combatResult.TotalRunningHPs.Add(blockingFighterId, totalHPs(blockingFighterId));

            combatResult.Comments = comments;

            return(combatResult);
        }