changed invincibility logic + fixed merge errors
This commit is contained in:
parent
5618e95940
commit
e0b399af43
|
@ -50,6 +50,7 @@ export enum BuffType {
|
||||||
SHIELD = "shield",
|
SHIELD = "shield",
|
||||||
SHIELD_DMG = "shielddmg", //increase shield dmg ratio
|
SHIELD_DMG = "shielddmg", //increase shield dmg ratio
|
||||||
LIFESTEAL = "lifesteal",
|
LIFESTEAL = "lifesteal",
|
||||||
|
LIFESTEALBUFF = "lifestealbuff",
|
||||||
EXTRALIFE= "extralife",
|
EXTRALIFE= "extralife",
|
||||||
ONESHOT = "oneshot"
|
ONESHOT = "oneshot"
|
||||||
}
|
}
|
||||||
|
@ -124,7 +125,8 @@ export default class PlayerController extends StateMachineAI implements BattlerA
|
||||||
shieldDamage : number = 1;
|
shieldDamage : number = 1;
|
||||||
hasDoubleStrike : Boolean = false;
|
hasDoubleStrike : Boolean = false;
|
||||||
hasLifesteal : Boolean = false;
|
hasLifesteal : Boolean = false;
|
||||||
|
lifestealratio : number = 0; //percent of damage to steal
|
||||||
|
hasOneShot: Boolean = false;
|
||||||
|
|
||||||
//TODO - add new buffs here
|
//TODO - add new buffs here
|
||||||
CURRENT_BUFFS: {
|
CURRENT_BUFFS: {
|
||||||
|
@ -232,9 +234,11 @@ export default class PlayerController extends StateMachineAI implements BattlerA
|
||||||
// TODO - figure out attacker
|
// TODO - figure out attacker
|
||||||
damage(damage: number, attacker?: GameNode): void {
|
damage(damage: number, attacker?: GameNode): void {
|
||||||
if (this.godMode) {
|
if (this.godMode) {
|
||||||
|
//console.log("godmode");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( !this.invincible && !PlayerState.dashTimer.isStopped()){
|
if( !this.invincible && PlayerState.dashTimer.isStopped()){
|
||||||
|
//console.log("take damage");
|
||||||
//i frame here
|
//i frame here
|
||||||
PlayerController.invincibilityTimer.start();
|
PlayerController.invincibilityTimer.start();
|
||||||
this.invincible = true;
|
this.invincible = true;
|
||||||
|
@ -260,6 +264,9 @@ export default class PlayerController extends StateMachineAI implements BattlerA
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
//console.log("player is invincible");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -288,7 +295,7 @@ export default class PlayerController extends StateMachineAI implements BattlerA
|
||||||
* @param val optional value to give buff
|
* @param val optional value to give buff
|
||||||
* @returns array of three Buffs
|
* @returns array of three Buffs
|
||||||
*/
|
*/
|
||||||
static generateBuffs( val? : number) : Buff[]{
|
generateBuffs( val? : number) : Buff[]{
|
||||||
//shuffle pool of buff categories
|
//shuffle pool of buff categories
|
||||||
PlayerController.buffPool.sort(() => 0.5 - Math.random());
|
PlayerController.buffPool.sort(() => 0.5 - Math.random());
|
||||||
|
|
||||||
|
@ -300,6 +307,7 @@ export default class PlayerController extends StateMachineAI implements BattlerA
|
||||||
num = val;
|
num = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO - implement better buff genertion - some buffs dont want multiple of
|
||||||
let attackBuffs : Buff[] = [
|
let attackBuffs : Buff[] = [
|
||||||
{type:BuffType.RANGE, value:num, category: BuffCategory.ATTACK},
|
{type:BuffType.RANGE, value:num, category: BuffCategory.ATTACK},
|
||||||
{type:BuffType.ATKSPEED, value:num, category: BuffCategory.ATTACK},
|
{type:BuffType.ATKSPEED, value:num, category: BuffCategory.ATTACK},
|
||||||
|
@ -315,23 +323,36 @@ export default class PlayerController extends StateMachineAI implements BattlerA
|
||||||
];
|
];
|
||||||
|
|
||||||
let shieldBuffs : Buff[] = [
|
let shieldBuffs : Buff[] = [
|
||||||
{type:BuffType.SHIELD, value:num, category: BuffCategory.SHIELD},
|
|
||||||
{type:BuffType.SHIELD_DMG, value:num, category: BuffCategory.SHIELD},
|
|
||||||
{type:BuffType.HEALTH, value:num, 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(!this.hasShield){
|
||||||
|
shieldBuffs.push({type:BuffType.SHIELD, value:num, category: BuffCategory.SHIELD});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
shieldBuffs.push({type:BuffType.SHIELD_DMG, value:num, category: BuffCategory.SHIELD});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
let healthBuffs : Buff[] = [
|
let healthBuffs : Buff[] = [
|
||||||
{type:BuffType.LIFESTEAL, value:num, category: BuffCategory.HEALTH},
|
{type:BuffType.DEF, value:num, category: BuffCategory.HEALTH}
|
||||||
{type:BuffType.DEF, value:num, category: BuffCategory.HEALTH},
|
|
||||||
{type:BuffType.LIFESTEAL, value:num, category: BuffCategory.HEALTH}, //increase lifesteal
|
|
||||||
];
|
];
|
||||||
|
if(!this.hasLifesteal){
|
||||||
|
shieldBuffs.push({type:BuffType.LIFESTEAL, value:num, category: BuffCategory.HEALTH});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
shieldBuffs.push({type:BuffType.LIFESTEALBUFF, value:num, category: BuffCategory.HEALTH});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
let extraBuffs : Buff[] = [
|
let extraBuffs : Buff[] = [
|
||||||
{type:BuffType.EXTRALIFE, value:num, category: BuffCategory.EXTRA},
|
{type:BuffType.EXTRALIFE, value:num, category: BuffCategory.EXTRA},
|
||||||
{type:BuffType.SPEED, value:num, category: BuffCategory.EXTRA},
|
{type:BuffType.SPEED, value:num, category: BuffCategory.EXTRA},
|
||||||
{type:BuffType.ATK, value:num, category: BuffCategory.EXTRA},
|
{type:BuffType.ATK, value:num, category: BuffCategory.EXTRA}
|
||||||
{type:BuffType.ONESHOT, value:num, category: BuffCategory.EXTRA},
|
|
||||||
];
|
];
|
||||||
|
if(!this.hasOneShot){
|
||||||
|
extraBuffs.push({type:BuffType.ONESHOT, value:num, category: BuffCategory.EXTRA});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
let selected = new Array();
|
let selected = new Array();
|
||||||
|
|
|
@ -253,7 +253,7 @@ export default class GameLevel extends Scene {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Player_Events.GIVE_BUFF:
|
case Player_Events.GIVE_BUFF:
|
||||||
this.buffs = PlayerController.generateBuffs();
|
this.buffs = (<PlayerController>this.player._ai).generateBuffs();
|
||||||
this.buffButton1.text = "Increase "+this.buffs[0].type.toString() + " by "+this.buffs[0].value;
|
this.buffButton1.text = "Increase "+this.buffs[0].type.toString() + " by "+this.buffs[0].value;
|
||||||
this.buffButton2.text = "Increase "+this.buffs[1].type + " by "+this.buffs[1].value;
|
this.buffButton2.text = "Increase "+this.buffs[1].type + " by "+this.buffs[1].value;
|
||||||
this.buffButton3.text = "Increase "+this.buffs[2].type + " by "+this.buffs[2].value;
|
this.buffButton3.text = "Increase "+this.buffs[2].type + " by "+this.buffs[2].value;
|
||||||
|
@ -548,7 +548,7 @@ export default class GameLevel extends Scene {
|
||||||
this.buffButton3.onClickEventId = "buff3";
|
this.buffButton3.onClickEventId = "buff3";
|
||||||
this.buffButton3.fontSize = 20;
|
this.buffButton3.fontSize = 20;
|
||||||
|
|
||||||
this.buffs = this.buffs = PlayerController.generateBuffs();
|
this.buffs = (<PlayerController>this.player._ai).generateBuffs();
|
||||||
|
|
||||||
this.buffLayer.disable();
|
this.buffLayer.disable();
|
||||||
|
|
||||||
|
@ -828,7 +828,7 @@ export default class GameLevel extends Scene {
|
||||||
this.player.position.set(this.playerSpawn.x,this.playerSpawn.y);
|
this.player.position.set(this.playerSpawn.x,this.playerSpawn.y);
|
||||||
|
|
||||||
//TODO - decrease player health or can kill player here
|
//TODO - decrease player health or can kill player here
|
||||||
(<PlayerController>this.player._ai).CURRENT_HP *= .75;
|
//(<PlayerController>this.player._ai).CURRENT_HP *= .75;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user