From 652484af7f13e8efddc702d609d2a4c02b29bd69 Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Sat, 11 Jan 2014 18:19:09 -0600 Subject: [PATCH] Older backgrounds for older gens --- js/battle.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/js/battle.js b/js/battle.js index 8803e3cda..109a3dcd8 100644 --- a/js/battle.js +++ b/js/battle.js @@ -705,7 +705,7 @@ function Battle(frame, logFrame, noPreload) { this.p2 = null; this.sides = []; this.lastMove = ''; - this.gen = 5; + this.gen = 6; this.frameElem = frame; this.logFrameElem = logFrame; @@ -768,7 +768,12 @@ function Battle(frame, logFrame, noPreload) { self.sides = [self.mySide, self.yourSide]; self.p1 = self.mySide; self.p2 = self.yourSide; - self.gen = 5; + self.gen = 6; + }; + this.updateGen = function () { + if (this.gen < 4) self.backdropImage = ''; + else if (this.gen < 6) self.backdropImage = 'bg.jpg'; + if (self.bgElem) self.bgElem.css('background-image','url(' + Tools.resourcePrefix + 'fx/' + self.backdropImage + ')'); }; this.reset = function (dontResetSound) { // battle state @@ -790,6 +795,7 @@ function Battle(frame, logFrame, noPreload) { self.logPreemptElem = logFrame.children().last(); logFrame.append('
'); + this.updateGen(); self.elem.append('
'); self.bgElem = self.elem.children().last(); self.bgElem.animate({ @@ -4906,6 +4912,7 @@ function Battle(frame, logFrame, noPreload) { break; case 'gen': self.gen = parseInt(args[1]); + self.updateGen(); break; case 'callback': args.shift();