コード例 #1
0
 public static Func<FullCombatCharacter, List<FullCombatCharacter>, CombatData, List<IEffect>> executeCommand(SelectedCommand command)
 {
     //In the future this will look through all of the available processors to find the right one to use
     return GeneralProcessor.executeCommand(command);
 }
コード例 #2
0
ファイル: Game.cs プロジェクト: BigBlueDot/fuzzy-octo-tribble
 public ICombatStatus executeCommand(SelectedCommand command)
 {
     return combat.executeCommand(command);
 }
コード例 #3
0
 public ICombatStatus executeCommand(SelectedCommand command)
 {
     //The non-dummy implementation will probably be handled in a separate class
     int target = 1;
     if (command.targets != null && command.targets.Count != 0)
     {
         target = command.targets[0];
     }
     if (command.commandName == "Flee")
     {
         List<IEffect> effectsList = new List<IEffect>();
         effectsList.Add(new DummyEffect(EffectTypes.Message, 0, "You have escaped successfully!", 0));
         effectsList.Add(new DummyEffect(EffectTypes.CombatEnded, 0, string.Empty, 0));
         return generateCombatStatus(effectsList, 0);
     }
     else if (command.commandName == "Attack")
     {
         List<IEffect> effectsList = new List<IEffect>();
         effectsList.Add(new DummyEffect(EffectTypes.DealDamage, target, string.Empty, 5));
         effectsList.Add(new DummyEffect(EffectTypes.Message, 0, "Damage has been dealt!", 0));
         return generateCombatStatus(effectsList, 5);
     }
     else if (command.commandName == "Magic")
     {
         target = command.subCommand.targets[0];
         if (command.subCommand.commandName == "Fireball")
         {
             List<IEffect> effectsList = new List<IEffect>();
             effectsList.Add(new DummyEffect(EffectTypes.DealDamage, target, string.Empty, 5));
             effectsList.Add(new DummyEffect(EffectTypes.Message, 0, "A gigantic fireball damages the target!", 0));
             return generateCombatStatus(effectsList, 5);
         }
         else if (command.subCommand.commandName == "Heal")
         {
             List<IEffect> effectsList = new List<IEffect>();
             effectsList.Add(new DummyEffect(EffectTypes.HealDamage, target, string.Empty, 5));
             effectsList.Add(new DummyEffect(EffectTypes.Message, 0, "A holy light heals a character.", 0));
             return generateCombatStatus(effectsList, 5);
         }
     }
     else if (command.commandName == "Heal")
     {
         List<IEffect> effectsList = new List<IEffect>();
         effectsList.Add(new DummyEffect(EffectTypes.HealDamage, 1, string.Empty, 5));
         effectsList.Add(new DummyEffect(EffectTypes.Message, 0, "Healed!", 0));
         return generateCombatStatus(effectsList, 5);
     }
     else if (command.commandName == "Guard")
     {
         List<IEffect> effectsList = new List<IEffect>();
         effectsList.Add(new DummyEffect(EffectTypes.Message, 0, "You are guarding.", 0));
         return generateCombatStatus(effectsList, 5);
     }
     else if (command.commandName == "Destroy")
     {
         List<IEffect> effectsList = new List<IEffect>();
         effectsList.Add(new DummyEffect(EffectTypes.DestroyCharacter, target, string.Empty, 5));
         return generateCombatStatus(effectsList, 5);
     }
     else if (command.commandName == "Game Over")
     {
         List<IEffect> effectsList = new List<IEffect>();
         effectsList.Add(new DummyEffect(EffectTypes.GameOver, 1, string.Empty, 5));
         return generateCombatStatus(effectsList, 5);
     }
     return getStatus();
 }
コード例 #4
0
        public static Func<FullCombatCharacter, List<FullCombatCharacter>, CombatData, List<IEffect>> executeCommand(SelectedCommand command)
        {
            switch (command.commandName)
            {
                case "Attack":
                    AbilityInfo ai = new AbilityInfo()
                    {
                        damageType = AbilityInfo.DamageType.Physical,
                        damageMultiplier = 5,
                        name = "Attack",
                        message = "{Name} has attacked {Target} for {Damage} damage!"
                    };

                    return ai.getCommand();
                case "Guard":
                    ai = new AbilityInfo()
                    {
                        name = "Guard",
                        message = "{Name} is guarding.",
                        ranged = true,
                        preExecute = ((FullCombatCharacter source, List<FullCombatCharacter> target, CombatData combatData, List<IEffect> effects, AbilityInfo abilityInfo) =>
                        {
                            source.mods.Add(BasicModificationsGeneration.getGuardModification(source.name));
                            return AbilityInfo.ProcessResult.Normal;
                        })
                    };

                    return ai.getCommand();
                case "Flee":
                    ai = new AbilityInfo()
                    {
                        name = "Flee",
                        message = "",
                        attackTimeCoefficient = 0.8f,
                        ranged = true,
                        postCleanup = ((FullCombatCharacter source, List<FullCombatCharacter> target, CombatData combatData, List<IEffect> effects, AbilityInfo abilityInfo) =>
                        {
                            if (!combatData.canFlee)
                            {
                                return AbilityInfo.ProcessResult.EndTurn;
                            }
                            combatData.currentFleeCount += source.agility;
                            int totalAgi = 0;
                            foreach (FullCombatCharacter fcc in target)
                            {
                                totalAgi += fcc.agility;
                            }
                            if (combatData.currentFleeCount >= totalAgi)
                            {
                                combatData.combatEndType = CombatEndType.Flee;
                                effects.Add(new Effect(EffectTypes.Message, 0, "You were able to run away!", 0));
                                effects.Add(new Effect(EffectTypes.CombatEnded, 0, string.Empty, 0));
                            }
                            else
                            {
                                effects.Add(new Effect(EffectTypes.Message, 0, "You were unable to run away!  (Keep trying, believe in yourself)", 0));
                            }

                            return AbilityInfo.ProcessResult.Normal;
                        })
                    };

                    return ai.getCommand();
                case "Range":
                    ai = new AbilityInfo()
                    {
                        name = "Range",
                        message = "{Name} has moved a distance from combat.",
                        ranged = true,
                        postCleanup = ((FullCombatCharacter source, List<FullCombatCharacter> target, CombatData combatData, List<IEffect> effects, AbilityInfo abilityInfo) =>
                        {
                            source.mods.Add(new PlayerModels.CombatDataModels.CombatModificationsModel()
                            {
                                name = "Ranged",
                                conditions = new List<PlayerModels.CombatDataModels.CombatConditionModel>()
                            });
                            return AbilityInfo.ProcessResult.Normal;
                        })
                    };

                    return ai.getCommand();
                case "Abilities":
                    foreach (string key in processors.Keys)
                    {
                        if (processors[key].isType(command.subCommand.commandName))
                        {
                            return processors[key].executeCommand(command.subCommand);
                        }
                    }
                    return ((FullCombatCharacter source, List<FullCombatCharacter> target, CombatData combatData) =>
                        {
                            List<IEffect> effects = new List<IEffect>();
                            return effects;
                        });

                default:
                    return ((FullCombatCharacter source, List<FullCombatCharacter> target, CombatData combatData) =>
                    {
                        List<IEffect> effects = new List<IEffect>();
                        return effects;
                    });
            }
        }
コード例 #5
0
        public ICombatStatus executeCommand(SelectedCommand command)
        {
            FullCombatCharacter source = currentCharacter;

            if (command.commandName == "Double")
            {
                combatData.doubleSelectionState = PlayerModels.CombatDataModels.CombatDataModel.DoubleSelectionState.First;
                currentEffects.Clear();
                currentEffects.Add(new Effect(EffectTypes.TurnEnded, 0, string.Empty, 0));
                return getStatus();
            }

            List<FullCombatCharacter> targets = new List<FullCombatCharacter>();
            SelectedCommand testCommand = command;
            while (testCommand != null)
            {
                if (testCommand.targets != null)
                {
                    foreach (int uniq in testCommand.targets)
                    {
                        FullCombatCharacter target = getTarget(uniq);
                        targets.Add(target);
                    }
                }
                testCommand = testCommand.subCommand;
            }
            if (targets.Count == 0) //Pass in all enemies if no single target was selected
            {
                foreach (int key in npcs.Keys)
                {
                    targets.Add(npcs[key]);
                }
            }
            Func<FullCombatCharacter, List<FullCombatCharacter>, CombatData, List<IEffect>> cmdExecute = AbilityDirector.executeCommand(command);
            currentEffects = cmdExecute(source, targets, combatData);
            combatData.setFirstTurnOver(source.name);
            BasicModificationsGeneration.endTurnForUser(getAllPcsAsList(), currentCharacter.name);
            BasicModificationsGeneration.endTurnForUser(getAllNpcsAsList(), currentCharacter.name);
            currentEffects.Add(new Effect(EffectTypes.TurnEnded, 0, string.Empty, 0));
            checkCombatEnded();
            return getStatus();
        }
コード例 #6
0
 public JsonResult executeCommand(SelectedCommand command)
 {
     Game game = checkGame();
     return Json(game.executeCommand(command));
 }
コード例 #7
0
        public Func<FullCombatCharacter, List<FullCombatCharacter>, CombatData, List<IEffect>> executeCommand(SelectedCommand command)
        {
            AbilityInfo ai;
            switch (command.commandName)
            {
                case "Glance":
                    ai = new AbilityInfo()
                    {
                        attackTimeCoefficient = .5f,
                        name = "Glance",
                        message = "{Target} has been glanced!",
                        preExecute = ((FullCombatCharacter source, List<FullCombatCharacter> target, CombatData combatData, List<IEffect> effects, AbilityInfo abilityInfo) =>
                        {
                            foreach (FullCombatCharacter t in target)
                            {
                                if (!BasicModificationsGeneration.hasMod(t, "Glance"))
                                {
                                    t.mods.Add(new PlayerModels.CombatDataModels.CombatModificationsModel()
                                    {
                                        name = "Glance",
                                        conditions = new List<PlayerModels.CombatDataModels.CombatConditionModel>()
                                    });
                                }
                            }
                            return AbilityInfo.ProcessResult.Normal;
                        })
                    };

                    return ai.getCommand();
                case "Guarded Strike":
                    ai = new AbilityInfo()
                    {
                        name = "Guarded Strike",
                        damageType = AbilityInfo.DamageType.Physical,
                        requiredClassLevel = 3,
                        message = "{Name} has dealt {Damage} damage to {Target}.",
                        damageMultiplier = 5,
                        preExecute = ((FullCombatCharacter source, List<FullCombatCharacter> target, CombatData combatData, List<IEffect> effects, AbilityInfo abilityInfo) =>
                        {
                            if (BasicModificationsGeneration.hasMod(source, "Guard"))
                            {
                                abilityInfo.attackTimeCoefficient = .75f;
                                abilityInfo.message = "{Name} attacks quicker due to guarding!  " + abilityInfo.message;
                            }
                            return AbilityInfo.ProcessResult.Normal;
                        })
                    };

                    return ai.getCommand();
                case "Reckless Hit":
                    ai = new AbilityInfo()
                    {
                        name = "Reckless Hit",
                        damageType = AbilityInfo.DamageType.Physical,
                        requiredClassLevel = 5,
                        attackTimeCoefficient = 1.2f,
                        damageMultiplier = 8,
                        message = "{Name} has dealt {Damage} damage to {Target} with a reckless attack.",
                        postExecute = ((FullCombatCharacter source, List<FullCombatCharacter> target, CombatData combatData, List<IEffect> effects, AbilityInfo abilityInfo) =>
                        {
                            source.mods.Add(BasicModificationsGeneration.getRecklessModification(source.name));
                            return AbilityInfo.ProcessResult.Normal;
                        })
                    };

                    return ai.getCommand();
                case "Guided Strike":
                    ai = new AbilityInfo()
                    {
                        name = "Guided Strike",
                        damageType = AbilityInfo.DamageType.Physical,
                        requiredClassLevel = 7,
                        damageMultiplier = 5,
                        message = "{Name} has dealt {Damage} damage to {Target} with a guided strike.",
                        preExecute = ((FullCombatCharacter source, List<FullCombatCharacter> target, CombatData combatData, List<IEffect> effects, AbilityInfo abilityInfo) =>
                        {
                            abilityInfo.damageCoefficient = 0.8f;
                            string preMessage = string.Empty;
                            if (BasicModificationsGeneration.hasMod(target[0], "Glance"))
                            {
                                abilityInfo.damageCoefficient = 1.2f;
                                abilityInfo.message = "{Name} is locked on!  " + abilityInfo.message;
                            }
                            return AbilityInfo.ProcessResult.Normal;
                        })
                    };

                    return ai.getCommand();
                case "Throw Rock":
                    ai = new AbilityInfo()
                    {
                        name = "Throw Rock",
                        damageType = AbilityInfo.DamageType.Physical,
                        requiredClassLevel = 9,
                        damageMultiplier = 5,
                        message = "{Name} has dealt {Damage} damage to {Target} by throwing a rock.",
                        ranged = true
                    };

                    return ai.getCommand();
                case "First Strike":
                    ai = new AbilityInfo()
                    {
                        name = "First Strike",
                        damageType = AbilityInfo.DamageType.Physical,
                        requiredClassLevel = 15,
                        damageMultiplier = 5,
                        damageCoefficient = 1.5f,
                        message = "{Name} is well rested.  {Name} has dealt {Damage} damage to {Target}",
                        preExecute = ((FullCombatCharacter source, List<FullCombatCharacter> target, CombatData combatData, List<IEffect> effects, AbilityInfo abilityInfo) =>
                        {
                            if (combatData.isFirstTurn(source.name))
                            {
                                return AbilityInfo.ProcessResult.Normal;
                            }
                            else
                            {
                                return AbilityInfo.ProcessResult.EndTurn;
                            }
                        })
                    };

                    return ai.getCommand();
                default:
                    return ((FullCombatCharacter source, List<FullCombatCharacter> target, CombatData combatData) =>
                    {
                        List<IEffect> effects = new List<IEffect>();
                        return effects;
                    });
            }
        }