Advertisement
GenericMadScientist

Forbidden Memories Field AI

Feb 1st, 2018
1,686
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.39 KB | None | 0 0
  1. 'The spreadsheet' refers to https://goo.gl/jrHE4f
  2.  
  3. The AI will always play a monster with its primary Guardian Star.
  4.  
  5. When I say the AI looks at visible player cards, I usually mean only face-up cards. However, if the opponent is one of Heishin 1, Pegasus, Heishin 2, Seto 3, DarkNite, or Nitemare, then this includes face-up and face-down cards.
  6.  
  7. When I say the AI lacks field control, I mean either only the player has a monster on the field, or both sides do and the base max stat plus field boost for the AI card with the highest true max stat is less than or equal to the same for the player's visible cards. In this case, I will use 'player's best card' to mean the earliest visible monster of the player's with the highest true max stat and 'AI's best card' to mean similarly for the AI's monsters.
  8.  
  9. When I say the AI executes DEFEND with a monster, I mean the AI puts it into defense unless it is one of
  10. Blue-Eyes Ultimate Dragon
  11. Gate Guardian
  12. Perfectly Ultimate Great Moth
  13. Meteor B. Dragon
  14. B. Skull Dragon
  15. Black Luster Soldier
  16. Blue-Eyes White Dragon
  17. Metalzoa,
  18. in which case the monster stays in attack.
  19.  
  20. Whenever the AI searches for a card with the lowest true max stat whether on the field or hand, cards with a true max stat of 9999 are ignored.
  21.  
  22. ================================================================================
  23.  
  24. First the AI goes through the cards in their magic zone. Each of the following cards is checked for in the given order, and they all come with an activation condition given below. If the condition is met the card is used, else the card is darkened. All cards in the magic zone not in this list (i.e., traps and Cursebreaker) are ignored.
  25.  
  26. Harpie's Feather Duster
  27. Player has cards in their magic zone, and then the probability the AI uses this card is Spell Probability from the spreadsheet.
  28.  
  29. Sparks
  30. Hinotama
  31. Final Flame
  32. Ookazi
  33. Tremendous Fire
  34. Mooyan Curry
  35. Red Medicine
  36. Goblin's Secret Remedy
  37. Soul of the Pure
  38. Dian Keto the Cure Master
  39. All have the same condition. The player must have more LP than the AI, and either the AI must be above their Low LP Threshold, or the player must have no cards in their magic zone, or otherwise the probability of activation is 100% - Spell Probability from the spreadsheet instead of 100%.
  40.  
  41. Equips (earliest on the field first)
  42. Has a monster that accepts the equip, in which case the earliest one is equipped.
  43.  
  44. Rituals (earliest on the field first)
  45. Can be successfully activated.
  46.  
  47. Dark-Piercing Light
  48. Player has at least 1 monster, all of them face-down, and have more monsters than the AI.
  49.  
  50. Swords of Revealing Light
  51. Player is not already under the effect of Swords of Revealing Light, and either only the player has a visible monster, or the player has a visible monster and the AI has a monster and out of those two sets of monsters, taking the ones with the best true max stats, the base max stat plus field boost for the player's best card is greater than the base max stat plus field boost for the AI's best card.
  52.  
  53. Stop Defense
  54. AI is not under the effect of Swords of Revealing Light, both sides have monsters on the field, and either the difference between the base attack plus field bonus for the AI card with the highest true attack and the same value for the visible player card with the lowest true attack is greater than or equal to the amount of LP the player has, or the AI has at least as many monsters as the player has visible monsters and each element of the sorted (in descending order) set of true attacks of visible player monsters is less than the corresponding element of the similarly sorted set of true attacks of AI monsters.
  55.  
  56. Dragon Capture Jar
  57. Warrior Elimination
  58. Eternal Rest
  59. Stain Storm
  60. Eradicating Aerosol
  61. Breath of Light
  62. Eternal Draught
  63. The AI lacks field control and the player's best card would be destroyed by the spell.
  64.  
  65. Spellbinding Circle
  66. Shadow Spell
  67. AI lacks field control.
  68.  
  69. Crush Card
  70. AI lacks field control and the base attack plus field boost of the player's best card is at least 1500.
  71.  
  72. Raigeki
  73. AI lacks field control and the number of visible monsters the player has is greater than or equal to the number of monsters the AI has.
  74.  
  75. Forest
  76. Wasteland
  77. Mountain
  78. Sogen
  79. Umi
  80. Yami
  81. AI lacks field control, the field is not already the type the field spell would change it to, the player's best card does not get boosted by the would-be new field, the AI's best card does not get weakened by the would-be new field, and either the player's best card is weakened by the would-be new field or the AI's best card is boosted by it. If the AI has no monsters on the field, then instead the checks pretend the AI does have a monster and its type is Dragon.
  82.  
  83. Dark Hole
  84. AI lacks field control, and the player has more monsters than the AI.
  85.  
  86. Next the AI looks for the following monsters in the following order, and they are all put into defense.
  87. Cocoon of Evolution
  88. Millennium Shield
  89. Labyrinth Wall
  90. Mystical Elf
  91. Dragon Piper
  92. Castle of Dark Illusions
  93. Metal Guardian
  94. Sleeping Lion
  95. Hard Armor
  96. Spirit of the Harp
  97. Prevent Rat
  98. Green Phantom King
  99. Gorgon Egg
  100. Wall Shadow
  101. Blocker
  102. Golgoil
  103. 30,000-Year White Turtle
  104. Queen Bird
  105. Yado Karu
  106. Boulder Tortoise
  107.  
  108. Next, if the AI is under the effect of Swords of Revealing Light then it executes DEFEND on each of its monsters in order of descending true attack. Otherwise it jumps to LBL_NEXT_BATTLE.
  109.  
  110. LBL_NEXT_BATTLE:
  111.  
  112. The AI first checks for lethal by picking its monster with highest true attack and the player's visible monster with the lowest true attack in attack position. Then it takes the base attack + field boost of both cards, and checks if the difference is greater than or equal to the player's Life Points. If so, it does the attack and then jumps back to LBL_NEXT_BATTLE.
  113.  
  114. If the player has no monsters on the field, the same calculation is done but giving the player a base attack + field boost of 0. If the player has monsters on the field but none of them are visible and in attack then this check is skipped.
  115.  
  116. Next the AI looks at the player's visible monsters in attack position, picking the earliest one with the best true attack that can be killed in battle by an AI's monster without suiciding. If there are any such monsters, the AI picks the card with the lowest true attack that can kill the player monster without suiciding and does that attack, before jumping back to LBL_NEXT_BATTLE.
  117.  
  118. Otherwise the AI looks at the player's visible monsters in defense position and does a similar calculation, except looking for the earliest best monster with the highest true defense the AI can kill.
  119.  
  120. Otherwise the player has no visible monsters. The AI then picks its unmoved monster with the highest true attack and looks at the non-visible player monsters from earliest to latest. For each one, the AI has a probability of Attack Probability of attacking that card with their card and then jumping to LBL_NEXT_BATTLE. If the AI has gone through all of the player's non-visible cards without attacking with their card, and the player has at least one monster on the field then the AI executes DEFEND on their card and jumps to LBL_NEXT_BATTLE.
  121.  
  122. If the AI gets this far then the player must have no monsters left. In which case the AI attacks directly with all their monsters in order of descending true attack, and then ends turn.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement