Skip to content

Instantly share code, notes, and snippets.

@coyotte508
Created December 13, 2012 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coyotte508/4278752 to your computer and use it in GitHub Desktop.
Save coyotte508/4278752 to your computer and use it in GitHub Desktop.
how to log a battle
BattleOld=Battle;
Battle = function Battle() {
var self = this, run, getPoke;
BattleOld.apply(self, arguments);
run = self.run;
self.run = function(str, preempt) {
console.log("run: " + str); run.apply(self,arguments);
};
getPoke = self.getPokemon;
self.getPokemon = function(){
console.log("getPoke: " + JSON.stringify(arguments));
getPoke.apply(self, arguments);
}
}
@coyotte508
Copy link
Author

BattleRoomOld = BattleRoom;

BattleRoom = function BattleRoom() {
var self = this, add;
BattleRoomOld.apply(self, arguments);
add = self.add;
self.add = function(data) {
console.log("add: " + data); add.apply(self,arguments);
};
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment