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