Skip to content

Commit

Permalink
added default card images
Browse files Browse the repository at this point in the history
  • Loading branch information
Zomis committed Aug 23, 2015
1 parent 258bf06 commit acb3b44
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ class CardDelegate implements GroovyInterceptable {
closure.delegate = this
closure.setResolveStrategy(resolveStrategy)
closure.call()
def closures = mod.cardMethodListeners.get('#after');
if (closures) {
closures.each {
it.delegate = this
it.setResolveStrategy(resolveStrategy)
it.call(entity)
}
}
return card
}

Expand Down Expand Up @@ -65,6 +73,8 @@ class CardDelegate implements GroovyInterceptable {
result = cl.call(args[0], args[1], args[2])
} else if (args.length == 4) {
result = cl.call(args[0], args[1], args[2], args[3])
} else {
throw new IllegalArgumentException("too many arguments for calling method " + name);
}
} else {
result = missingMethod(entity, mod, name, args)
Expand Down
4 changes: 4 additions & 0 deletions extra-resources/mods/Cyborg-Chronicles/Game.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ onCard('creature') {entity, args ->
entity.taunt = 1
}

onCard('#after') {entity ->
imagePath 'cyborg-chronicles/default.png'
}

// General game configuration

config {
Expand Down
4 changes: 4 additions & 0 deletions extra-resources/mods/Mythos/Game.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ include 'spells'

// General game configuration

onCard('#after') {entity ->
imagePath 'mythos/default.png'
}

config {
println 'Game closure! (Mythos)'

Expand Down
2 changes: 1 addition & 1 deletion extra-resources/mods/creatures.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ cardExtension('flavor') {String value ->
* imagePath "https://upload.wikimedia.org/wikipedia/commons/c/c8/Jupiter_Smyrna_Louvre_Ma13.jpg"
*/
cardExtension('imagePath') {String value ->
ESCAttributeMap.createOrGetFor(entity).set(Attributes.IMAGE_PATH, value)
ECSAttributeMap.createOrGetFor(entity).set(Attributes.IMAGE_PATH, value)
}

// Define creature entity and related actions and values
Expand Down
4 changes: 4 additions & 0 deletions test-resources/mods/TestMod/Game.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ onCard('creature') {entity, args ->
entity.taunt = 1
}

onCard('#after') {entity ->
imagePath 'img'
}

/**
* General game configuration
*/
Expand Down

0 comments on commit acb3b44

Please sign in to comment.