took out enemies before forest start checkpoint, fixed empty buff object

This commit is contained in:
OfficialCHenry 2022-04-24 16:13:32 -04:00
parent a65873c349
commit da1f86628d
3 changed files with 41 additions and 23 deletions

View File

@ -38,18 +38,6 @@
"type": "player", "type": "player",
"x": 5, "x": 5,
"y": 19 "y": 19
},
{
"type": "black_pudding",
"x": 7,
"y": 19,
"possibility": 1
},
{
"type": "Snake",
"x": 1,
"y": 10,
"possibility": 1
} }
], ],
"startCheckPoint": [25, 19, 5, 5] "startCheckPoint": [25, 19, 5, 5]

View File

@ -361,13 +361,14 @@ export default class PlayerController extends StateMachineAI implements BattlerA
dotBuffs.push({type:BuffType.POISON, value:1, category: BuffCategory.DOT, string: "Your hits \napply poison"}); dotBuffs.push({type:BuffType.POISON, value:1, category: BuffCategory.DOT, string: "Your hits \napply poison"});
} }
if(dotBuffs.length < 3){ //only add extra dot if at least one dot is acquired //only add extra dot if at least one dot is acquired
for(let i=dotBuffs.length; i< 3 ; i++){
dotBuffs.push({type:BuffType.EXTRA_DOT, value:num, category: BuffCategory.DOT, string: "increase your \nDOT damage"}); dotBuffs.push({type:BuffType.EXTRA_DOT, value:num, category: BuffCategory.DOT, string: "increase your \nDOT damage"});
} }
let shieldBuffs : Buff[] = [ let shieldBuffs : Buff[] = [
{type:BuffType.HEALTH, value:1, category: BuffCategory.SHIELD}, {type:BuffType.HEALTH, value:num, category: BuffCategory.SHIELD},
]; ];
//if player doesnt have shield buff, give them the option, otherwise give buff shield option //if player doesnt have shield buff, give them the option, otherwise give buff shield option
if(!this.hasShield){ if(!this.hasShield){
@ -405,23 +406,48 @@ export default class PlayerController extends StateMachineAI implements BattlerA
switch(cat){ switch(cat){
case BuffCategory.ATTACK: case BuffCategory.ATTACK:
attackBuffs.sort(() => 0.5 - Math.random()); attackBuffs.sort(() => 0.5 - Math.random());
selected.push(attackBuffs.pop()); if(attackBuffs.length == 0){
selected.push({type:BuffType.RANGE, value:num/10, category: BuffCategory.ATTACK});
}
else{
selected.push(attackBuffs.pop());
}
break; break;
case BuffCategory.DOT: case BuffCategory.DOT:
dotBuffs.sort(() => 0.5 - Math.random()); dotBuffs.sort(() => 0.5 - Math.random());
selected.push(dotBuffs.pop()); if(dotBuffs.length == 0){
selected.push({type:BuffType.EXTRA_DOT, value:num, category: BuffCategory.DOT, string: "increase your \nDOT damage"});
}
else{
selected.push(dotBuffs.pop());
}
break; break;
case BuffCategory.EXTRA: case BuffCategory.EXTRA:
extraBuffs.sort(() => 0.5 - Math.random()); extraBuffs.sort(() => 0.5 - Math.random());
selected.push(extraBuffs.pop()); if(extraBuffs.length ==0 ){
selected.push({type:BuffType.EXTRALIFE, value:1, category: BuffCategory.EXTRA, string: "Gain an \nExtra Life"});
}
else{
selected.push(extraBuffs.pop());
}
break; break;
case BuffCategory.HEALTH: case BuffCategory.HEALTH:
healthBuffs.sort(() => 0.5 - Math.random()); healthBuffs.sort(() => 0.5 - Math.random());
selected.push(healthBuffs.pop()); if(healthBuffs.length == 0){
selected.push({type:BuffType.DEF, value: num/10, category: BuffCategory.HEALTH, string: "decrease damage\n taken by "+num*10+"%"});
}
else{
selected.push(healthBuffs.pop());
}
break; break;
case BuffCategory.SHIELD: case BuffCategory.SHIELD:
shieldBuffs.sort(() => 0.5 - Math.random()); shieldBuffs.sort(() => 0.5 - Math.random());
selected.push(shieldBuffs.pop()); if(shieldBuffs.length ==0 ){
selected.push({type:BuffType.HEALTH, value:num, category: BuffCategory.SHIELD});
}
else{
selected.push(shieldBuffs.pop());
}
break; break;
} }
} }
@ -519,11 +545,17 @@ export default class PlayerController extends StateMachineAI implements BattlerA
*/ */
getStats(): Record<string, any>{ getStats(): Record<string, any>{
let stats = {} as Record<string,any>; let stats = {} as Record<string,any>;
stats.current_health = this.CURRENT_HP; stats.CURRENT_HP = this.CURRENT_HP;
stats.CURRENT_ATK = this.CURRENT_ATK;
stats.CURRENT_SHIELD = this.CURRENT_SHIELD;
stats.CURRENT_EXP = this.CURRENT_EXP;
return return
} }
toString(): string{
return "";
}
} }

View File

@ -998,8 +998,6 @@ export default class GameLevel extends Scene {
//damage the player //damage the player
(<PlayerController>this.player._ai).damage(10); //10 collision dmg for now (<PlayerController>this.player._ai).damage(10); //10 collision dmg for now
} }
} }