Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        //public override CombatResult Resolve(CombatMove OpponentMove)
        //{
        //    return base.Resolve(OpponentMove);
        //}

        /// <summary>
        /// This Fighter RESTS, Opponent Fighter RESTS
        /// Check previous heals on both fighters
        /// Both heal points with bonus if applicable
        /// </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();

            ICombatHistoryResolver successfulHealHistoryResolver = new SuccessfulHealHistoryResolver(_combatSession);

            //get count of how may times This Fighter has been successfully healed consecutively
            //int totalThisHealPoints = 1 + numberPreviousSuccessfulHeals(thisFighterId, opponentFighterId);
            //int totalThisHealPoints = 1 + numberPreviousSuccessfulHeals(thisFighterId);
            int totalThisHealPoints = 1 + successfulHealHistoryResolver.Resolve(thisFighterId);

            //get count of how may times Opponent Fighter has been successfully healed consecutively
            //int totalOpponentHealPoints = numberPreviousSuccessfulHeals(opponentFighterId, thisFighterId);
            //int totalOpponentHealPoints = numberPreviousSuccessfulHeals(opponentFighterId);
            int totalOpponentHealPoints = 1 + successfulHealHistoryResolver.Resolve(opponentFighterId);

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

            //combatResult.HPAdjustments[thisFighterId] = totalThisHealPoints;
            //combatResult.HPAdjustments[opponentFighterId] = totalOpponentHealPoints;
            combatResult.HPAdjustments.Add(thisFighterId, totalThisHealPoints);
            combatResult.HPAdjustments.Add(opponentFighterId, totalOpponentHealPoints);

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

            combatResult.Comments = "Both knights heal.";

            return(combatResult);
        }