//treat 0 as none even though its technically shield. private byte GetMutatedAttack(byte oldAttackId, EnemyObject enemy) { //likely that an attack with no associated animation will soft lock the game if (oldAttackId == 0 || oldAttackId == 255) { return(oldAttackId); } var doMutation = Agent.Rng.NextDouble(); if (doMutation > Agent.Probabilities.EnemyAttackMutationRate) { return(oldAttackId); } var attackTier = AttackTierList.GetAttackTier(oldAttackId); var newTier = RandomFunctions.GenerateGaussianByte(Agent.Rng, attackTier, 1, (byte)(AttackTierList.TieredAtpIds.Count - 1)); var changeType = Agent.Rng.NextDouble(); var oldType = AttackTierList.GetAttackType(oldAttackId); if (oldType == "") { return(oldAttackId); } var newType = GetNewType(oldType, Agent.Probabilities.EnemyAttackTypeMutationRate, newTier); List <int> attackList = AttackTierList.GetTierList(newType, newTier); var attackIndex = Agent.Rng.Next(0, attackList.Count); return((byte)attackList[attackIndex]); }
public static IServiceCollection AddWildArmsRandomizerServices(this IServiceCollection serviceCollection) { serviceCollection.AddSingleton <IRandomizerAgent, RandomizerAgent>(); serviceCollection.AddTransient <IRandomizerManager, RandomizerManager>(); serviceCollection.AddTransient <ISparsityMode, SparsityMode>(); serviceCollection.AddTransient <IThreeOrbMode, ThreeOrbMode>(); serviceCollection.AddTransient <IAnalysisMode, AnalysisMode>(); serviceCollection.AddTransient <IAlwaysRunOption, AlwaysRunOption>(); serviceCollection.AddTransient <IBossRebalancerOption, BossRebalancerOption>(); serviceCollection.AddTransient <ICeciliaSpellsOption, CeciliaSpellsOption>(); serviceCollection.AddTransient <IEventReducerOption, EventReducerOption>(); serviceCollection.AddTransient <IExperienceFlattenerOption, ExperienceFlattenerOption>(); serviceCollection.AddTransient <IItemPriceCorrectionOption, ItemPriceCorrectionOption>(); serviceCollection.AddTransient <ISwitchAnywhereOption, SwitchAnywhereOption>(); serviceCollection.AddTransient <IUberBelselkOption, UberBelselkOption>(); serviceCollection.AddTransient <IVehiclesAvailableOption, VehiclesAvailableOption>(); serviceCollection.AddTransient <ISoloFightBufferOption, SoloFightBufferOption>(); serviceCollection.AddTransient <IAreaRandomizer, AreaRandomizer>(); serviceCollection.AddTransient <IArmRandomizer, ArmRandomizer>(); serviceCollection.AddTransient <IAttackRandomizer, AttackRandomizer>(); serviceCollection.AddTransient <IElementRandomizer, ElementRandomizer>(); serviceCollection.AddTransient <IEnemyRandomizer, EnemyRandomizer>(); serviceCollection.AddTransient <IEventRandomizer, EventRandomizer>(); serviceCollection.AddTransient <IFastDrawRandomizer, FastDrawRandomizer>(); serviceCollection.AddTransient <IItemRandomizer, ItemRandomizer>(); serviceCollection.AddTransient <IShoppingListRandomizer, ShoppingListRandomizer>(); serviceCollection.AddTransient <ISpellRandomizer, SpellRandomizer>(); serviceCollection.AddTransient <ISummonRandomizer, SummonRandomizer>(); var attackTierList = new AttackTierList(); attackTierList.LoadData(Resources.AttackTierList); serviceCollection.AddSingleton <IAttackTierList>(attackTierList); var bossOrbTierList = new BossOrbTierList(); bossOrbTierList.LoadData(Resources.BossOrbGroups); serviceCollection.AddSingleton <IBossOrbTierList>(bossOrbTierList); var enemyTierList = new EnemyTierList(); enemyTierList.LoadData(Resources.BossTierList); serviceCollection.AddSingleton <IEnemyTierList>(enemyTierList); var itemTierList = new ItemTierList(); itemTierList.LoadData(Resources.ItemTierList); serviceCollection.AddSingleton <IItemTierList>(itemTierList); return(serviceCollection); }
private bool EnemyHasMagicAttack(EnemyObject enemy) { if (AttackTierList.GetAttackType(enemy.Attack1Id).Equals(SorType) || AttackTierList.GetAttackType(enemy.Attack1Id).Equals(SorType) || AttackTierList.GetAttackType(enemy.Attack2Id).Equals(SorType) || AttackTierList.GetAttackType(enemy.Attack3Id).Equals(SorType) || AttackTierList.GetAttackType(enemy.Attack4Id).Equals(SorType) || AttackTierList.GetAttackType(enemy.Attack5Id).Equals(SorType) || AttackTierList.GetAttackType(enemy.Attack6Id).Equals(SorType) || AttackTierList.GetAttackType(enemy.Attack7Id).Equals(SorType)) { return(true); } return(false); }
private string GetNewType(string oldType, double mutationRate, int tier) { var changeType = Agent.Rng.NextDouble(); if (changeType > mutationRate && AttackTierList.GetTierList(oldType, tier).Count > 0) { return(oldType); } double coinFlip = Agent.Rng.NextDouble(); var type = FlipType(oldType, coinFlip > 0.5); if (AttackTierList.GetTierList(type, tier).Count > 0) { return(type); } type = FlipType(oldType, coinFlip <= 0.5); if (AttackTierList.GetTierList(type, tier).Count > 0) { return(type); } return(oldType); }