private ProcessResult PreProcess(FullCombatCharacter source, List <FullCombatCharacter> target, CombatData combatData, List <IEffect> effects) { //Determine if it's a valid skill or on cooldown etc if (source.classLevel < requiredClassLevel || combatData.hasCooldown(source.name, cooldown) || target.Count > maxTargets) { return(ProcessResult.EndTurn); } if (BasicModificationsGeneration.hasMod(source, "Ranged")) { damageCoefficient = damageCoefficient * .75f; if (!ranged) { effects.Add(new Effect(EffectTypes.Message, 0, "Using a melee attack has removed the ranged advantage!", 0)); CombatCalculator.removeRanged(source); } } if (oncePerRest != string.Empty && source.usedAbilities.Contains(oncePerRest)) { return(ProcessResult.EndTurn); } return(ProcessResult.Normal); }
public ICombatStatus nextTurn() { calculateTurnOrder(); currentTime = currentCharacter.nextAttackTime; BasicModificationsGeneration.checkModifications(getAllPcsAsList(), currentTime); BasicModificationsGeneration.checkModifications(getAllNpcsAsList(), currentTime); combatData.removeCooldowns(currentTime); calculateTurn(true); checkDeath(); return(getStatus()); }
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()); }
private void calculateTurn(bool killPreviousTurn) { //This is where all the stuff is calculated until the player's next move if (killPreviousTurn) { currentEffects.Clear(); } if (BasicModificationsGeneration.hasMod(currentCharacter, "Arcane Prison")) { currentCharacter.nextAttackTime += 50; currentEffects.Add(new Effect(EffectTypes.Message, 0, currentCharacter.name + " is unable to move!", 0)); combatData.setFirstTurnOver(currentCharacter.name); BasicModificationsGeneration.endTurnForUser(getAllPcsAsList(), currentCharacter.name); BasicModificationsGeneration.endTurnForUser(getAllNpcsAsList(), currentCharacter.name); currentEffects.Add(new Effect(EffectTypes.TurnEnded, 0, string.Empty, 0)); } else { if (currentCharacterIsPC) { currentEffects.Add(new Effect(EffectTypes.ShowCommand, 0, string.Empty, 0)); } else { List <IEffect> enemyEffects = BasicAbilityProcessing.getCommand(currentCharacter, getAllPcsAsList(), combatData); combatData.setFirstTurnOver(currentCharacter.name); BasicModificationsGeneration.endTurnForUser(getAllPcsAsList(), currentCharacter.name); BasicModificationsGeneration.endTurnForUser(getAllNpcsAsList(), currentCharacter.name); foreach (IEffect e in enemyEffects) { currentEffects.Add(e); } currentEffects.Add(new Effect(EffectTypes.TurnEnded, 0, string.Empty, 0)); } } //Update Combat Data Models updateDataModels(); }
public static void calculateNextAttackTime(FullCombatCharacter character, float abilityCoefficient, CombatData combatData) { int nextAttackTime; if (combatData.doubleSelectionState != PlayerModels.CombatDataModels.CombatDataModel.DoubleSelectionState.None) { abilityCoefficient = abilityCoefficient * 1.5f; } if (BasicModificationsGeneration.hasMod(character, "Adrenaline")) { nextAttackTime = calculateNextAttackTime(character.nextAttackTime, abilityCoefficient / 3, character.agility); } else { nextAttackTime = calculateNextAttackTime(character.nextAttackTime, abilityCoefficient, character.agility); } if (combatData.doubleSelectionState == PlayerModels.CombatDataModels.CombatDataModel.DoubleSelectionState.None) { character.nextAttackTime = nextAttackTime; } else { if (combatData.doubleSelectionState == PlayerModels.CombatDataModels.CombatDataModel.DoubleSelectionState.First) { combatData.doubleSelectionDelay = nextAttackTime; combatData.doubleSelectionState = PlayerModels.CombatDataModels.CombatDataModel.DoubleSelectionState.Second; } else { combatData.doubleSelectionDelay += (nextAttackTime - character.nextAttackTime); character.nextAttackTime = combatData.doubleSelectionDelay; combatData.doubleSelectionState = PlayerModels.CombatDataModels.CombatDataModel.DoubleSelectionState.None; } } }
public Func <List <FullCombatCharacter>, List <FullCombatCharacter>, CombatData, List <IEffect> > initialExecute(FullCombatCharacter source) { return((List <FullCombatCharacter> allies, List <FullCombatCharacter> enemies, CombatData combatData) => { List <IEffect> effects = new List <IEffect>(); if (source.className == "Adventurer" && source.classLevel >= 13) { foreach (FullCombatCharacter fcc in enemies) { if (!BasicModificationsGeneration.hasMod(fcc, "Glance")) { CombatModificationsModel cmm = new CombatModificationsModel(); cmm.name = "Glance"; cmm.conditions = new List <CombatConditionModel>(); fcc.mods.Add(cmm); cmm = null; } } effects.Add(new Effect(EffectTypes.Message, 0, "All enemies have been glanced by " + source.name + "'s Insight ability!", 0)); } return effects; }); }
public List <ICommand> getCommands() { List <ICommand> returnValue = new List <ICommand>(); int currentCharacter = getCurrentPC(); if (currentCharacter != 0) { returnValue.Add(new Command(false, new List <ICommand>(), false, 0, 0, "Attack", false, 0, true, false)); List <ICommand> abilityCommands = ClassProcessor.AbilityDirector.getClassAbilities(pcs[uniqBridge[currentCharacter]], combatData); bool abilityDisabled = true; foreach (ICommand command in abilityCommands) { if (!command.isDisabled) { abilityDisabled = false; } } returnValue.Add(new Command(true, abilityCommands, false, 0, 0, "Abilities", false, 0, false, abilityDisabled)); returnValue.Add(new Command(false, new List <ICommand>(), false, 0, 0, "Guard", false, 0, false, !(combatData.doubleSelectionState == PlayerModels.CombatDataModels.CombatDataModel.DoubleSelectionState.None))); returnValue.Add(new Command(false, new List <ICommand>(), false, 0, 0, "Range", false, 0, false, BasicModificationsGeneration.hasMod(pcs[uniqBridge[currentCharacter]], "Ranged"))); returnValue.Add(new Command(false, new List <ICommand>(), false, 0, 0, "Double", false, 0, false, !(combatData.doubleSelectionState == PlayerModels.CombatDataModels.CombatDataModel.DoubleSelectionState.None) || combatData.isFirstTurn(pcs[uniqBridge[currentCharacter]].name))); returnValue.Add(new Command(false, new List <ICommand>(), false, 0, 0, "Flee", false, 0, false, !combatData.canFlee)); } return(returnValue); }
public Func <LiveImplementation.FullCombatCharacter, List <LiveImplementation.FullCombatCharacter>, LiveImplementation.CombatData, List <Interfaces.IEffect> > executeCommand(Interfaces.SelectedCommand command) { AbilityInfo ai; switch (command.commandName) { case "Magic Dart": ai = new AbilityInfo() { name = "Magic Dart", message = "{Name} has dealt {Damage} to {Target} with a Magic Dart.", ranged = true, damageMultiplier = 5, maxTargets = 1, damageType = AbilityInfo.DamageType.Magical }; return(ai.getCommand()); case "Magic Missile": ai = new AbilityInfo() { name = "Magic Dart", message = "{Name} has dealt {Damage} to {Target} with a Magic Missile.", ranged = true, damageMultiplier = 15, maxTargets = 1, mpCost = 1, requiredClassLevel = 3, damageType = AbilityInfo.DamageType.Magical }; return(ai.getCommand()); case "Arcane Prison": ai = new AbilityInfo() { name = "Arcane Prison", message = "{Name} has sealed {Target} in an arcane prison.", ranged = false, maxTargets = 1, cooldown = "Arcane Prison", cooldownDuration = 180, requiredClassLevel = 7, preExecute = ((FullCombatCharacter source, List <FullCombatCharacter> target, CombatData combatData, List <IEffect> effects, AbilityInfo abilityInfo) => { foreach (FullCombatCharacter t in target) { if (!BasicModificationsGeneration.hasMod(t, "Disarmed")) { List <PlayerModels.CombatDataModels.CombatConditionModel> conditions = new List <PlayerModels.CombatDataModels.CombatConditionModel>(); conditions.Add(new PlayerModels.CombatDataModels.CombatConditionModel() { name = "Time", state = (source.nextAttackTime + 100).ToString() }); t.mods.Add(new PlayerModels.CombatDataModels.CombatModificationsModel() { name = "Arcane Prison", conditions = conditions }); } } return(AbilityInfo.ProcessResult.Normal); }) }; return(ai.getCommand()); default: return((FullCombatCharacter source, List <FullCombatCharacter> target, CombatData combatData) => { List <IEffect> effects = new List <IEffect>(); return effects; }); } }
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 Func <LiveImplementation.FullCombatCharacter, List <LiveImplementation.FullCombatCharacter>, LiveImplementation.CombatData, List <Interfaces.IEffect> > executeCommand(Interfaces.SelectedCommand command) { AbilityInfo ai; switch (command.commandName) { case "Disarming Blow": ai = new AbilityInfo() { name = "Disarming Blow", message = "{Name} has dealt {Damage} damage to {Target} with a disarming blow.", requiredClassLevel = 3, damageMultiplier = 5, damageType = AbilityInfo.DamageType.Physical, cooldown = "Disarming Blow", cooldownDuration = 60, preExecute = ((FullCombatCharacter source, List <FullCombatCharacter> target, CombatData combatData, List <IEffect> effects, AbilityInfo abilityInfo) => { foreach (FullCombatCharacter t in target) { if (!BasicModificationsGeneration.hasMod(t, "Disarmed")) { List <PlayerModels.CombatDataModels.CombatConditionModel> conditions = new List <PlayerModels.CombatDataModels.CombatConditionModel>(); conditions.Add(new PlayerModels.CombatDataModels.CombatConditionModel() { name = "Time", state = (source.nextAttackTime + 60).ToString() }); t.mods.Add(new PlayerModels.CombatDataModels.CombatModificationsModel() { name = "Disarmed", conditions = conditions }); } } return(AbilityInfo.ProcessResult.Normal); }) }; return(ai.getCommand()); case "One-Two Punch": ai = new AbilityInfo() { name = "One-Two Punch", message = "{Name} has dealt {HitCount}x{Damage} damage to {Target} with a One-Two Punch.", requiredClassLevel = 7, damageMultiplier = 5, damageCoefficient = 0.75f, damageType = AbilityInfo.DamageType.Physical, cooldown = "One-Two Punch", cooldownDuration = 120, hits = 2 }; return(ai.getCommand()); case "Sweep": ai = new AbilityInfo() { name = "Sweep", message = "{Name} dealt damage to all enemies with a sweeping blow!", requiredClassLevel = 9, maxTargets = 10, damageMultiplier = 5, damageCoefficient = 0.5f, attackTimeCoefficient = 1.5f, damageType = AbilityInfo.DamageType.Physical, cooldown = "Sweep", cooldownDuration = 180 }; return(ai.getCommand()); case "Preemptive Strike": ai = new AbilityInfo() { name = "Preemptive Strike", message = "{Name} dealt {Damage} damage to {Target} with a Preemptive Strike!", requiredClassLevel = 13, damageMultiplier = 5, damageCoefficient = 1.5f, damageType = AbilityInfo.DamageType.Physical, cooldown = "Preemptive Strike", cooldownDuration = 120, preExecute = ((FullCombatCharacter source, List <FullCombatCharacter> target, CombatData combatData, List <IEffect> effects, AbilityInfo abilityInfo) => { FullCombatCharacter currentTarget = target[0]; foreach (FullCombatCharacter t in target) { if (currentTarget.nextAttackTime > t.nextAttackTime) { currentTarget = t; } } target.Clear(); target.Add(currentTarget); return(AbilityInfo.ProcessResult.Normal); }) }; return(ai.getCommand()); case "Vicious Blow": ai = new AbilityInfo() { name = "Vicious Blow", message = "{Name} dealt {Damage} damage to {Target} with a Vicious Blow!", requiredClassLevel = 15, damageMultiplier = 5, damageCoefficient = 1.5f, damageType = AbilityInfo.DamageType.Physical, cooldown = "Vicious Blow", cooldownDuration = 180, preExecute = ((FullCombatCharacter source, List <FullCombatCharacter> target, CombatData combatData, List <IEffect> effects, AbilityInfo abilityInfo) => { FullCombatCharacter currentTarget = target[0]; if (currentTarget.hp * 2 > currentTarget.maxHP) { abilityInfo.message = "{Name}'s vicious blow missed {Target}!"; abilityInfo.damageCoefficient = 0.0f; } return(AbilityInfo.ProcessResult.Normal); }) }; return(ai.getCommand()); case "Adrenaline": ai = new AbilityInfo() { name = "Adrenaline", message = "Adrenaline pumps through {Name}!", requiredClassLevel = 17, oncePerRest = "Adrenaline", preExecute = ((FullCombatCharacter source, List <FullCombatCharacter> target, CombatData combatData, List <IEffect> effects, AbilityInfo abilityInfo) => { source.mods.Add(BasicModificationsGeneration.getAdrenalineModification((source.nextAttackTime + 60).ToString())); return(AbilityInfo.ProcessResult.Normal); }) }; 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; }); } }