Exemple #1
0
        public Dictionary <int, ExchangeProfile> ProcessMoves(FightMove playerMove, FightMove opponentMove)
        {
//            playerMove.SkillId   = (byte) EffectEnum.DAMAGE;
//            opponentMove.SkillId = (byte) EffectEnum.DAMAGE;

            var instance = fight.getParticipant(playerMove.PeerObjectId);
            var opponent = fight.getParticipant(opponentMove.PeerObjectId);

            if (instance == null || opponent == null)
            {
                DebugUtils.Logp(DebugUtils.Level.FATAL, CLASSNAME, "ProcessMoves", "instance or opponent in fight.getParticipant is null");
            }

            var playerOutcome   = CheckAhitB(playerMove, opponentMove); //check if player A's attack has succeeded(Hit) or was blocked(Block)
            var opponentOutcome = CheckAhitB(opponentMove, playerMove); // -- || --

            var playerEnv   = new SpellEnvironment(instance, playerMove.SkillId, opponent, opponentMove.SkillId);
            var opponentEnv = new SpellEnvironment(opponent, opponentMove.SkillId, instance, playerMove.SkillId);

            sendOnApplyToSpells(playerEnv);

            var opponentTeamDamage = ProcessOutcome(playerEnv, playerOutcome);     //do the actual hit/block, with all the stats
            var playerTeamDamage   = ProcessOutcome(opponentEnv, opponentOutcome); //do the actual hit/block, with all the stats

            sendOnUpdateToSpells(playerEnv);

            fight.updateTotalTeamHealth(fight.getPlayerTeam(opponent), -opponentTeamDamage);
            fight.updateTotalTeamHealth(fight.getPlayerTeam(instance), -playerTeamDamage);

            if (DEBUG)
            {
                Log.DebugFormat("{0}({1})<-dmg: {2}(team total left {3}/ {4}({5})<-dmg: {6} (team total left {7}",
                                fight.getPlayerTeam(instance), instance.ToString(), playerTeamDamage, fight.getTotalTeamHealth(fight.getPlayerTeam(instance)),
                                fight.getPlayerTeam(opponent), opponent.ToString(), opponentTeamDamage, fight.getTotalTeamHealth(fight.getPlayerTeam(opponent)));
            }

            return(resultForClient);
        }
Exemple #2
0
        public int ProcessOutcome(SpellEnvironment env, MoveOutcome outcome)
        {
            const string METHODNAME = "ProcessOutcome";
            var          attacker   = env.Character;
            var          target     = env.Target;

            var attackerStats = attacker.Stats;
            var damage        = (int)attackerStats.GetStat(new Damage(), target); //calculates rng damage (minDmg <= dmg <= maxDmg) and applies target negation

            switch (outcome)
            {
            case (MoveOutcome.Hit):
                //HIT CHANCE VS TARGET'S DODGE CHANCE
                if (attackerStats.GetStat(new HitChance(), target) > RngUtil.hundredRoll())
                {
                    //CRIT CHANCE VS TARGET'S ANTI-CRIT CHANCE, if fails then HIT
                    damage = attackerStats.GetStat(
                        new CriticalHitChance(), target) > RngUtil.hundredRoll()    ? applyOutcome(attacker, target, MoveOutcome.Crit, damage)
                                                                                        : applyOutcome(attacker, target, MoveOutcome.Hit, damage);
                }
                else
                {
                    //IF HIT 'MISSES' ITS A DODGE
                    damage = applyOutcome(attacker, target, MoveOutcome.Dodge, damage);
                }
                break;

            case (MoveOutcome.Block):
                damage = applyOutcome(attacker, target,
                                      attacker.Stats.GetStat(new CriticalHitChance(), target) * 0.2f > RngUtil.hundredRoll()  ? MoveOutcome.BlockCrit
                                                                                                                : MoveOutcome.Block,
                                      damage);
                break;
            }

            return(damage);
        }
Exemple #3
0
 private void sendOnUpdateToSpells(SpellEnvironment env)
 {
     env.Character.Effects.OnUpdate();
     env.Target.Effects.OnUpdate();
 }
Exemple #4
0
 private void sendOnApplyToSpells(SpellEnvironment env)
 {
     env.Character.Effects.UseSpell(env.CharacterSpell);
     env.Target.Effects.UseSpell(env.TargetSpell);
 }
Exemple #5
0
 public void UseSpell(SpellEnvironment env)
 {
     UseSpell(env.CharacterSpell);
 }