Last active
December 24, 2015 15:19
-
-
Save chiting/6819649 to your computer and use it in GitHub Desktop.
https://www.bloc.io/ruby-warrior godmode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # It doesn't work anymore with the new version of https://www.bloc.io/ruby-warrior#/ | |
| class Player | |
| def play_turn(warrior) | |
| lol = warrior.instance_variable_get(:@senses) | |
| me = lol[:health].instance_variable_get(:@unit) | |
| me.send(:define_singleton_method, :attack_power, lambda { 10000 }) | |
| me.send(:define_singleton_method, :max_health, lambda { 10000000 }) | |
| if warrior.respond_to? :feel | |
| space = warrior.feel | |
| case | |
| when space.enemy? | |
| warrior.attack! | |
| when space.captive? | |
| warrior.rescue! | |
| when space.wall? | |
| warrior.pivot! | |
| else | |
| warrior.walk! | |
| end | |
| else | |
| warrior.walk! | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment