public static string AttackSequence(Player attacker, Player victim, SkillViewModel skillBeingUsed, bool timestamp = true) { // Actual attack var(_, message) = AttackProcedures.Attack(attacker, victim, skillBeingUsed, timestamp); // record into statistics StatsProcedures.AddStat(attacker.MembershipId, StatsProcedures.Stat__SpellsCast, 1); if (AIStatics.IsABoss(victim.BotId)) { StatsProcedures.AddStat(attacker.MembershipId, StatsProcedures.Stat__BossAllAttacks, 1); } if (victim.BotId == AIStatics.FemaleRatBotId || victim.BotId == AIStatics.MaleRatBotId) { StatsProcedures.AddStat(attacker.MembershipId, StatsProcedures.Stat__BossRatThiefAttacks, 1); } else if (victim.BotId == AIStatics.BimboBossBotId) { StatsProcedures.AddStat(attacker.MembershipId, StatsProcedures.Stat__BossLovebringerAttacks, 1); } else if (victim.BotId == AIStatics.DonnaBotId) { StatsProcedures.AddStat(attacker.MembershipId, StatsProcedures.Stat__BossDonnaAttacks, 1); } else if (victim.BotId == AIStatics.FaebossBotId) { StatsProcedures.AddStat(attacker.MembershipId, StatsProcedures.Stat__FaebossAttacks, 1); } else if (victim.BotId == AIStatics.MouseNerdBotId || victim.BotId == AIStatics.MouseBimboBotId) { StatsProcedures.AddStat(attacker.MembershipId, StatsProcedures.Stat__MouseSisterAttacks, 1); } else if (victim.BotId == AIStatics.MotorcycleGangLeaderBotId) { StatsProcedures.AddStat(attacker.MembershipId, StatsProcedures.Stat__MotorcycleGangAttacks, 1); } else if (AIStatics.IsAMiniboss(victim.BotId) && victim.BotId != AIStatics.MinibossPlushAngelId) // The plush just wants to make friends. No rewards for monsters. { StatsProcedures.AddStat(attacker.MembershipId, StatsProcedures.Stat__MinibossAttacks, 1); } // Trigger any counterattack AIProcedures.CheckAICounterattackRoutine(attacker, victim); return(message); }
public override string Execute(IDataContext context) { ContextQuery = ctx => { // Donna if (target.BotId == AIStatics.DonnaBotId) { if (futureForm == null || futureForm.MobilityType == PvPStatics.MobilityFull) { return($"You get the feeling this type of spell won't work against {target.GetFullName()}. Maybe a different one would do..."); } } // Bimbo Boss if (target.BotId == AIStatics.BimboBossBotId) { // disallow animate spells if (futureForm == null || futureForm.MobilityType == PvPStatics.MobilityFull) { return($"You get the feeling this type of spell won't work against {target.GetFullName()}. Maybe a different one would do..."); } } // Thieves Boss if (target.BotId == AIStatics.MaleRatBotId || target.BotId == AIStatics.FemaleRatBotId) { // only allow inanimate spells if (futureForm == null || futureForm.MobilityType != PvPStatics.MobilityInanimate) { return($"You get the feeling this type of spell won't work against {target.GetFullName()}. Maybe a different one would do..."); } } // Motorcycle boss if (target.BotId == AIStatics.MotorcycleGangLeaderBotId) { if (futureForm == null || !BossProcedures_MotorcycleGang.SpellIsValid(futureForm.MobilityType)) { return($"You get the feeling this type of spell won't work against {target.GetFullName()}. Maybe a different one would do..."); } } // Narcissa if (target.BotId == AIStatics.FaebossBotId) { var isValid = BossProcedures_FaeBoss.SpellIsValid(spellSourceId, attacker); if (!isValid.Item1) { return(isValid.Item2); } } // Mouse Sisters Boss if (target.BotId == AIStatics.MouseNerdBotId || target.BotId == AIStatics.MouseBimboBotId) { string result = BossProcedures_Sisters.SpellIsValid(attacker, target, spellSourceId); if (!result.IsNullOrEmpty()) { return(result); } } if (AIStatics.IsAMiniboss(target.BotId) && (futureForm == null || (futureForm.MobilityType != PvPStatics.MobilityInanimate && futureForm.MobilityType != PvPStatics.MobilityPet))) { return("Your target seems immune from this kind of spell. Maybe a different one would do..."); } if (target.BotId == AIStatics.MinibossPlushAngelId && (attacker.FormSourceId == 97 || attacker.FormSourceId == 427 || attacker.FormSourceId == 620)) { return("You two are already the best of friends! Why not try again later?"); } // Dungeon Demons can only be vanquished if (target.BotId == AIStatics.DemonBotId && spellSourceId != PvPStatics.Dungeon_VanquishSpellSourceId && spellSourceId != PvPStatics.Spell_WeakenId) { return("Only the 'Vanquish' spell and Weaken have any effect on the Dark Demonic Guardians."); } return(""); }; return(ExecuteInternal(context)); }
public static IEnumerable <SkillViewModel> AvailableSkills(Player attacker, Player target, bool includeArchived) { IEnumerable <SkillViewModel> output = SkillProcedures.GetSkillViewModelsOwnedByPlayer(attacker.Id); if (!includeArchived) { output = output.Where(s => !s.dbSkill.IsArchived); } // filter out spells that you can't use on your target if (FriendProcedures.PlayerIsMyFriend(attacker, target) || target.BotId < AIStatics.ActivePlayerBotId) { // do nothing, all spells are okay } // both players are in protection; only allow animate spells else if (attacker.GameMode == (int)GameModeStatics.GameModes.Protection && target.GameMode == (int)GameModeStatics.GameModes.Protection) { output = output.Where(s => s.MobilityType == PvPStatics.MobilityFull); } // attack or the target is in superprotection and not a friend or bot; no spells work else if (target.GameMode == (int)GameModeStatics.GameModes.Superprotection || (attacker.GameMode == (int)GameModeStatics.GameModes.Superprotection && target.BotId == AIStatics.ActivePlayerBotId)) { output = output.Where(s => s.MobilityType == "NONEXISTANT"); } // either player invisible; no spells work else if (target.GameMode == (int)GameModeStatics.GameModes.Invisible || attacker.GameMode == (int)GameModeStatics.GameModes.Invisible) { output = output.Where(s => s.MobilityType == "NONEXISTENT"); } // filter out MC spells for bots if (target.BotId < AIStatics.ActivePlayerBotId) { output = output.Where(s => s.MobilityType != PvPStatics.MobilityMindControl); } // only show inanimates for rat thieves if (target.BotId == AIStatics.MaleRatBotId || target.BotId == AIStatics.FemaleRatBotId) { output = output.Where(s => s.MobilityType == PvPStatics.MobilityInanimate); } // only show Weaken for valentine if (target.BotId == AIStatics.ValentineBotId) { output = output.Where(s => s.dbSkill.SkillSourceId == PvPStatics.Spell_WeakenId); } // only bimbo spell works on nerd mouse boss if (target.BotId == AIStatics.MouseNerdBotId) { output = output.Where(s => s.StaticSkill.Id == BossProcedures_Sisters.BimboSpellSourceId); } // only nerd spell works on nerd bimbo boss if (target.BotId == AIStatics.MouseBimboBotId) { output = output.Where(s => s.StaticSkill.Id == BossProcedures_Sisters.NerdSpellSourceId); } // Vanquish and weaken only works against dungeon demons if (target.BotId == AIStatics.DemonBotId) { output = output.Where(s => s.StaticSkill.Id == PvPStatics.Dungeon_VanquishSpellSourceId || s.StaticSkill.Id == PvPStatics.Spell_WeakenId); } // Filter out Vanquish when attacking non-Dungeon Demon player if (target.BotId != AIStatics.DemonBotId) { output = output.Where(s => s.StaticSkill.Id != PvPStatics.Dungeon_VanquishSpellSourceId); } // Fae-In-A-Bottle only works against Narcissa if (target.BotId == AIStatics.FaebossBotId) { output = output.Where(s => s.StaticSkill.Id == BossProcedures_FaeBoss.SpellUsedAgainstNarcissaSourceId); } // Filter out Fae-In-A-Bottle when attacking non-Narcissa player if (target.BotId != AIStatics.FaebossBotId) { output = output.Where(s => s.StaticSkill.Id != BossProcedures_FaeBoss.SpellUsedAgainstNarcissaSourceId); } // only inanimate and animal spells work on minibosses, donna, and lovebringer if (AIStatics.IsAMiniboss(target.BotId) || target.BotId == AIStatics.MotorcycleGangLeaderBotId || target.BotId == AIStatics.BimboBossBotId) { output = output.Where(s => s.MobilityType == PvPStatics.MobilityInanimate || s.MobilityType == PvPStatics.MobilityPet); } return(output); }
public static void CheckAICounterattackRoutine(Player personAttacking, Player bot) { // person attacking is a boss and not a psychopath, so do nothing if (personAttacking.BotId < AIStatics.PsychopathBotId) { return; } // attacking the psychopath. Random chance the psychopath will set the attacker as their target. if (bot.BotId == AIStatics.PsychopathBotId) { if (personAttacking.BotId == AIStatics.ActivePlayerBotId) { var rand = new Random(); var numAttacks = NumPsychopathCounterAttacks(bot, rand); var(mySkills, weakenSkill, _) = GetPsychopathSkills(bot); if (!mySkills.IsEmpty()) { var complete = false; for (int i = 0; i < numAttacks && !complete; i++) { var skill = SelectPsychopathSkill(personAttacking, mySkills, weakenSkill, rand); (complete, _) = AttackProcedures.Attack(bot, personAttacking, skill); } if (complete) { EquipDefeatedPlayer(bot, personAttacking); } } } var directive = AIDirectiveProcedures.GetAIDirective(bot.Id); // no previous target, so set this player as the new one if (directive.TargetPlayerId == -1 || directive.State == "idle") { AIDirectiveProcedures.SetAIDirective_Attack(bot.Id, personAttacking.Id); } // random chance to see if the attacker becomes the new target else { var rand = new Random(); var roll = rand.NextDouble(); if (roll < .08) { AIDirectiveProcedures.SetAIDirective_Attack(bot.Id, personAttacking.Id); } } } // if the target is Donna, counterattack and set that player as her target immediately if (bot.BotId == AIStatics.DonnaBotId) { BossProcedures_Donna.DonnaCounterattack(personAttacking, bot); } // Valentine counterattack if (bot.BotId == AIStatics.ValentineBotId) { BossProcedures_Valentine.CounterAttack(personAttacking, bot); } // Bimbo boss counterattack else if (bot.BotId == AIStatics.BimboBossBotId) { BossProcedures_BimboBoss.CounterAttack(personAttacking, bot); } // rat thieves counterattack else if (bot.BotId == AIStatics.MaleRatBotId || bot.BotId == AIStatics.FemaleRatBotId) { AIProcedures.DealBossDamage(bot, personAttacking, true, 1); BossProcedures_Thieves.CounterAttack(personAttacking); } // fae boss counterattack else if (bot.BotId == AIStatics.FaebossBotId) { AIProcedures.DealBossDamage(bot, personAttacking, true, 1); BossProcedures_FaeBoss.CounterAttack(personAttacking); } // motocycle boss counterattack else if (bot.BotId == AIStatics.MotorcycleGangLeaderBotId) { AIProcedures.DealBossDamage(bot, personAttacking, true, 1); BossProcedures_MotorcycleGang.CounterAttack(personAttacking, bot); } // mouse sisters counterattack else if (bot.BotId == AIStatics.MouseNerdBotId || bot.BotId == AIStatics.MouseBimboBotId) { BossProcedures_Sisters.CounterAttack(personAttacking, bot); } // demon counterattack else if (bot.BotId == AIStatics.DemonBotId) { BossProcedures_DungeonDemon.CounterAttack(bot, personAttacking); } // miniboss counterattack else if (AIStatics.IsAMiniboss(bot.BotId)) { BossProcedures_Minibosses.CounterAttack(personAttacking, bot); } }