File tree 3 files changed +11
-21
lines changed
3 files changed +11
-21
lines changed Original file line number Diff line number Diff line change 132
132
if ( this . battle . ended ) this . battleEnded = true ;
133
133
this . updateLayout ( ) ;
134
134
this . updateControls ( ) ;
135
- for ( var i = 0 ; i < log . length ; i ++ ) {
136
- var logLine = log [ i ] ;
137
- // i don't like this hardcode, and my preferred solution would be not this
138
- // but i don't know how many bugs would be caused by having BattleRoom#add
139
- // not `return` the running of this function - i suspect a lot
140
- // and i also don't want to move the |badge| message into battle.ts, since it's not simulator-related
141
- // so we're doing this, for now. open to suggestions
142
- if ( logLine . substr ( 0 , 7 ) === '|badge|' ) {
143
- this . add ( logLine ) ;
144
- }
145
- }
146
135
} ,
147
136
add : function ( data ) {
148
137
if ( ! data ) return ;
227
216
break ;
228
217
}
229
218
} else if ( logLine . substr ( 0 , 7 ) === '|title|' ) { // eslint-disable-line no-empty
230
- } else if ( logLine . substr ( 0 , 7 ) === '|badge|' ) {
231
- var parts = logLine . split ( '|' ) . slice ( 2 ) ;
232
- var slot = parts . shift ( ) ;
233
- var side = this . battle [ slot ] ;
234
- if ( ! side ) return ; // weird
235
- // handle all the rendering further down
236
- side . badges . push ( parts . join ( '|' ) ) ;
237
- this . battle . scene . updateSidebar ( side ) ;
238
219
} else if ( logLine . substr ( 0 , 5 ) === '|win|' || logLine === '|tie' ) {
239
220
this . battleEnded = true ;
240
221
this . battle . stepQueue . push ( logLine ) ;
Original file line number Diff line number Diff line change @@ -709,8 +709,8 @@ export class BattleScene implements BattleSceneStub {
709
709
}
710
710
return (
711
711
`<div class="trainer trainer-${ posStr } "${ faded } ><strong>${ BattleLog . escapeHTML ( side . name ) } </strong>` +
712
- `<div class="trainersprite"${ ratinghtml } style="background-image:url(${ Dex . resolveAvatar ( side . avatar ) } )">${ badgehtml } ` +
713
- `</div>${ pokemonhtml } </div>`
712
+ `<div class="trainersprite"${ ratinghtml } style="background-image:url(${ Dex . resolveAvatar ( side . avatar ) } )">` +
713
+ `</div>${ badgehtml } ${ pokemonhtml } </div>`
714
714
) ;
715
715
}
716
716
updateSidebar ( side : Side ) {
Original file line number Diff line number Diff line change @@ -3536,6 +3536,15 @@ export class Battle {
3536
3536
this . scene . updateSidebar ( side ) ;
3537
3537
break ;
3538
3538
}
3539
+ case 'badge' : {
3540
+ const slot = args [ 1 ] as SideID ;
3541
+ var side = this [ slot ] ;
3542
+ if ( ! side ) return ; // weird
3543
+ // handle all the rendering further down
3544
+ side . badges . push ( args . slice ( 2 ) . join ( '|' ) ) ;
3545
+ this . scene . updateSidebar ( side ) ;
3546
+ break ;
3547
+ }
3539
3548
case 'teamsize' : {
3540
3549
let side = this . getSide ( args [ 1 ] ) ;
3541
3550
side . totalPokemon = parseInt ( args [ 2 ] , 10 ) ;
You can’t perform that action at this time.
0 commit comments