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; }); } }
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; }); } }