Skip to content

Automated addition of cards to the game, started a script to play the game, successfully added ~20 cards to game, and included all F22 work #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@ nosetests.xml
## PyCharm
.idea/*

*/.DS_Store

git-commit-msg.txt
Binary file added AMHR/automation/Fall 2022/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Deathtouch # any damage done to creature will cause the other creature to die
Defender # creature with defender cannot attack
Double_Strike # creature can do its combat damage twice
First_Strike # creature deals combat damage first before other creatures
Flash # card can be played anytime they could cast an instant
Flying # creature can fly and can only be blocked by creatures with flying/reach
Haste # creature is not affected by 'summoning sick' rule
Hexproof # doesnt allow permanent or player to be targeted by an opponent
Indestructible # permanent cannot be destroyed
Menace # makes creatures unblockable by a single creature
Lifelink # causes player to gain life when creature/permanent deals damage
Reach # creature can block creature with flying
Convoke # lets you tap creatures rather than pay mana to cast spell
Trample # creature deal excess combat damage to a defending player or planeswalker while attacking.
Vigilance # lets creature attack without having to tap
Plainswalk #
Islandwalk
Swampwalk
Mountainwalk
Forestwalk
Intimidate
Shroud
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
W # WHITE
B # BLUE
B # BLACK
R # RED
G # GREEN
C # COLORLESS
G # GENERIC
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
ATTRIBUTES
name, mana_cost, color, types, subtype, supertype, text, abilities, power, toughness, loyalty

PLAYER
self.controller

is_active()
opponent()
creatures()
lands()
get_zone(zone_type)
draw()
gain_life(amount)
lose_life(amount)
set_life_total(value)
create_token(self, attributes, num=1, keyword_abilities=[], activated_abilities=[])
make_choice(prompt_string, ...)
bolster()
investigate()
take_damage(amount)

LIBRARY
self.controller

apply_to_zone(apply_func, _zone, condition=lambda p: True)
change_zone(target_zone, from_top, shuffle=True, status_mod=None, modi_func=None)

CHECKERS
self.card

is_land()
is_basic_land()
is_creature()
is_instant()
is_sorcery()
is_artifact()
is_enchantment()
is_aura()
is_equipment()
has_ability(ability)
share_color(other)
has_color(color)
is_color(color)
is_monocolored()
is_multicolored()
is_colorless()
has_subtype(subtype)
exile()
has_valid_target()
can_attack()
can_block()
blocks(creature)
in_combat()
sacrifice()
check_effect_expiration()

PROPERTIES
self.game

eot_time()
apply_to_battlefield()
players_list

PERMANENT
self.card

tap()
untap()
freeze()
attacks(player)
exits_combat()
take_damage(source, dmg, is_combat=False) # """ target could be Player, Creature, or array of creatures"""
deals_damage(target, dmg, is_combat)
destroy()
dies()
exile()
bounce()
flicker()
activate_ability(num=0)
add_effect(name, value, source=None, expiration=math.inf, is_active=True, toggle_func=lambda eff: True)
add_counter(stringVar)
num_counter(stringVar)

enchant(target)
disenchant()
add_ability(ability)
add_pt(PT)
make_permanent(card, status_mod=None, modi_func=None)
make_aura(card, enchant_target)
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
onPlay # i think old cards use play and new cards use ETB synonymously
onDraw # when you draw a card
onDiscard # when this card is discarded
onEtB # when this permanent is put on the battlefield
onPlayfromHand # when this card is played from your hand
onEnterGrave # when this card enters the graveyard
onDeath # when this card dies
onLeaveBattlefield # when this card leaves the battlefield
onUpkeep # at the start of the upkeep phase (between untap and draw steps)
onMain1 # at the start of the first main phase (after begin, before combat)
onMain2 # at the start of the second main phase (after combat, before end)
onEnterCombat # when this card enters combat (declared as attacker?)
onRevolt # when a permanent you controlled left the battlefield this turn, max 1 time
onCreatureEtB # when a creature ETB
onDeclareAttackers #Activates at Phase.COMBAT: gamesteps.Step.DECLARE_ATTACKERS of self
# when ability gets activated/deactivated during declare attackers phase
onDeclareBlockers #Activates at Phase.COMBAT: gamesteps.Step.DECLARE_BLOCKERS of self
# when ability gets activated/deactivated during declare blockers phase
onEndofCombat #Activates at Phase.COMBAT: gamesteps.Step.END_OF_COMBAT of self
# when ability gets activated/deactivated at end of combat phase
onEndstep #Activates on Step.END: Phase.ENDING
# when ability gets activated/deactivated at end step
onCleanup #Activites on Step.CLEANUP: Phase.ENDING
# when ability gets activated/deactivated at cleanup step

onControllerUpkeep #Activates at Phase.BEGINNING: Step.UPKEEP, when self.controller = self
# when ability gets activated/deactivated at beginning upkeep step
onControllerMain1 #Activates at Phase.PRECOMBAT_MAIN: Step.PRECOMBAT_MAIN of self
# when ability gets activated/deactivated at precombat main
onControllerMain2 #Activates at Phase.POSTCOMBAT_MAIN: Step.POSTCOMBAT_MAIN of self
# when ability gets activated/deactivated at postcombat main

onControllerEnterCombat #Activates at Phase.COMBAT: gamesteps.Step.BEGINNING_OF_COMBAT of self.controller
# ability gets activated/deactivated when [selected] enters combat
onControllerDeclareAttackers #Activates at Phase.COMBAT: gamesteps.Step.DECLARE_ATTACKERS of self.controller
# same as onDeclareAttackers with target selection option
onControllerDeclareBlockers #Activates at Phase.COMBAT: gamesteps.Step.DECLARE_BLOCKERS of self.controller
# same as onDeclareBlockers with target selection option
onControllerEndofCombat #Activates at Phase.COMBAT: gamesteps.Step.END_OF_COMBAT of self.controller
# same as onEndofCombat with target selection option
onPermanentEtB #When Permanent is initialized, (played on the battlefield) on -> self.zone = self.controller.battlefield
onControllerCreatureEtBa #When Controller-> Creature is initialized on -> self.zone = self.controller.battlefield
onControllerEndstep # end step: last opportunity for controller to perform any action before next player's turn #
onUntap # when card gets untapped
onTap # when card gets tapped
onDealDamageToPlayers # when dealing damage to opponent
onDealDamageToCreatures # when dealing damage to another creature
onDealDamage # when dealing damage to opponent/creature
onTakeDamage # when card takes damage (source does not matter apparently)
onAttack # when card attacks
onBlock # when card blocks
onCombatDamage # when card does combat damage
onCombatDamageToPlayers # when card does combat damage directly to players
onControllerPermanentEtB # when a controller's permanent enters the battlefield
onLifeLoss # when controller loses life
onCombatDamageToCreatures # When card does combat damage to the opponent's creatures
onTakeCombatDamage # When card takes combat damage from another player
onControllerLifeLoss # When the owner of the card loses a life
onLifeGain # When the card gains life
onControllerLifeGain # When the player gains a life

***************** Probably not worth it to investigate
##ambiguous## onCounterPutOnPermanent # When the card can permanently counter attacks? #(card Negate(counter), Pillar of light(permanent))
onControllerCounterPutOnPermanent # When the player can permanently counter attcks?
*****************

onDrawCard # When card draws a card
onControllerDrawCard # When the owner of the card draws a card
onPlayerDiscard # When a player gives up cards
onControllerDiscard # When the owner of the card give up cards
onPermanentLtB # When the card leaves the battlefield permanently (cannot find an example)
onControllerCleanup # When the owner of the card resets battlefield values # Phase.ENDING: (Step.END, Step.CLEANUP)
115 changes: 115 additions & 0 deletions AMHR/automation/Fall 2022/manual conversions/ben.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
##############################
Intimidation Bolt

Targets:
'creature'

# deal 3 damage to target creature
targets[0].take_damage(self, 3)
# other creatures can't attack this turn
[c.summoning_sick=True for c in self.controller.battlefield if c.is_creature and c is not targets[0]]

##############################


##############################
Putrid Leech

Abilities:
Pay 2 life: self.card.add_effect('modifyPT', (2, 2), self, self.game.eot_time)

##############################


##############################
Vedalken Heretic

Triggers:
onDealDamage
self.controller.draw(1)

##############################


##############################
Phyrexian Arena
Triggers:
onUpkeep
self.controller.lose_life(1)
self.controller.draw(1)

##############################


##############################
Banners Raised
Triggers:
onPlay
[c.add_effect('modifyPT', (1, 0), self, self.game.eot_time) for c in self.controller.battlefield if c.is_creature]

##############################


##############################fix
Disciple of Bolas
Targets:
'creature'

Triggers:
onEtB # when Disciple of Bolas enters the battlefield,
X = targets[0].power
targets[0].destroy() # sacrifice another creature; X = creature's power
self.controller.gain_life(X) # gain X life
self.controller.draw(X) # draw X cards

##############################


##############################
Touch of the Eternal

Triggers:
onUpkeep # at the beginning of your upkeep,
# count the number of permanents you control; your life total becomes that number
self.controller.set_life_total(sum([1 for c in self.controller.battlefield if c.is_permanent]))

##############################


##############################fix
Angelic Accord

Triggers:
onUpkeep # at start of turn, note current controller life
starting_life = self.controller.life

onControllerLifeGain # on life gain, update amount life has changed
life_change += starting_life - self.controller.life

onEndstep # at the beginning of each end step
if life_change >= 4: # if you gained 4 or more life this turn
# create a 4/4 white Angel creature token with flying
self.controller.create_token('4/4 white Angel', 1, 'Flying')

##############################


##############################
Caustic Wasps

Triggers:
onCombatDamageToPlayers # whenever Caustic Wasps deals combat damage to a player
# you may destroy target artifact that player controls
Targets:
p.is_artifact and p.controller is not self.controller
targets[0].destroy()

##############################


##############################
Tower of Fortunes

8, T: self.controller.draw(4) # pay 8 colorless mana, and tap to draw 4 cards

##############################
Loading