diff --git a/dist/shattered_sword_assets/data/weaponData.json b/dist/shattered_sword_assets/data/weaponData.json index ef9bb15..a2e79ce 100644 --- a/dist/shattered_sword_assets/data/weaponData.json +++ b/dist/shattered_sword_assets/data/weaponData.json @@ -7,7 +7,7 @@ "displayName": "Knife", "animationSprite": "slice", "spriteKey": "knife", - "damage": 50, + "damage": 10, "cooldown": 30, "useVolume": 0 } diff --git a/dist/shattered_sword_assets/spritesheets/slice.json b/dist/shattered_sword_assets/spritesheets/slice.json index 4f68387..3862151 100644 --- a/dist/shattered_sword_assets/spritesheets/slice.json +++ b/dist/shattered_sword_assets/spritesheets/slice.json @@ -1,6 +1,6 @@ { "name": "slice", - "spriteSheetImage": "slice.png", + "spriteSheetImage": "slice_black.png", "spriteWidth": 16, "spriteHeight": 16, "columns": 4, diff --git a/dist/shattered_sword_assets/spritesheets/slice_black.png b/dist/shattered_sword_assets/spritesheets/slice_black.png new file mode 100644 index 0000000..5e912d5 Binary files /dev/null and b/dist/shattered_sword_assets/spritesheets/slice_black.png differ diff --git a/dist/shattered_sword_assets/spritesheets/slice_red.png b/dist/shattered_sword_assets/spritesheets/slice_red.png new file mode 100644 index 0000000..8683d79 Binary files /dev/null and b/dist/shattered_sword_assets/spritesheets/slice_red.png differ diff --git a/src/shattered_sword/AI/EnemyAI.ts b/src/shattered_sword/AI/EnemyAI.ts index d6ebeb0..24c143c 100644 --- a/src/shattered_sword/AI/EnemyAI.ts +++ b/src/shattered_sword/AI/EnemyAI.ts @@ -128,7 +128,7 @@ export default class EnemyAI extends StateMachineGoapAI implements BattlerAI { this.bleedTimer = new Timer(1000); this.poisonTimer = new Timer(1000); - this.attackTimer = new Timer(500); + this.attackTimer = new Timer(2500); } activate(options: Record): void { } @@ -217,7 +217,7 @@ export default class EnemyAI extends StateMachineGoapAI implements BattlerAI { if (hit !== null && start.distanceSqTo(hit.pos) < start.distanceSqTo(pos)) { // We hit a wall, we can't see the player - console.log("player not visible") + //console.log("player not visible") return null; } } @@ -287,10 +287,10 @@ export default class EnemyAI extends StateMachineGoapAI implements BattlerAI { return; } let distance = this.owner.position.distanceTo(this.getPlayerPosition()); - if( distance <= 60){ + if( distance <= 20){ if( this.direction == Math.sign(this.getPlayerPosition().x -this.owner.position.x) ){ let dir = this.getPlayerPosition().clone().sub(this.owner.position).normalize(); - if(this.attackTimer.isPaused()){ + if(this.attackTimer.isStopped()){ this.weapon.use(this.owner, "enemy", dir.scale(1,0)) this.attackTimer.start(); } diff --git a/src/shattered_sword/Player/PlayerController.ts b/src/shattered_sword/Player/PlayerController.ts index 46a1b6a..1bb281e 100644 --- a/src/shattered_sword/Player/PlayerController.ts +++ b/src/shattered_sword/Player/PlayerController.ts @@ -88,11 +88,8 @@ export default class PlayerController extends StateMachineAI implements BattlerA MAX_HP: number = 100; CURRENT_HP: number = 100; BASE_ATK: number = 100; - MAX_ATK: number = 100; CURRENT_ATK: number = 100; - BASE_DEF: number = 100; - MAX_DEF: number = 100; - CURRENT_DEF: number = 100; + damage_multiplier: number = 1; CURRENT_EXP : number = 0; MAX_EXP : number = 100; CURRENT_SHIELD : number =0; @@ -117,7 +114,9 @@ export default class PlayerController extends StateMachineAI implements BattlerA static invincibilityTimer: Timer; - static buffPool : Array; + static buffPool : Array = new Array(); + + static appliedBuffs: Array = new Array(); //add to current_buffs later hasBleed : Boolean = false; @@ -239,7 +238,6 @@ export default class PlayerController extends StateMachineAI implements BattlerA } - // TODO - figure out attacker damage(damage: number, attacker?: GameNode): void { if (this.godMode) { @@ -265,7 +263,8 @@ export default class PlayerController extends StateMachineAI implements BattlerA this.invincible = true; //console.log("hurt anim"); (this.owner).animation.play("HURT" ); - damage /= this.BASE_DEF/ this.CURRENT_DEF; + damage *= this.damage_multiplier; + damage = parseFloat(damage.toPrecision(2)); this.CURRENT_HP -= damage; this.emitter.fireEvent(GameEventType.PLAY_SOUND, {key: "hurt", loop: false, holdReference: false}); @@ -380,7 +379,7 @@ export default class PlayerController extends StateMachineAI implements BattlerA let healthBuffs : Buff[] = [ - {type:BuffType.DEF, value: num, category: BuffCategory.HEALTH} + {type:BuffType.DEF, value: num/10, category: BuffCategory.HEALTH, string: "decrease damage by"+num/10+"%"} ]; if(!this.hasLifesteal){ healthBuffs.push({type:BuffType.LIFESTEAL, value:1, category: BuffCategory.HEALTH, string:"Gain lifesteal"}); @@ -438,7 +437,8 @@ export default class PlayerController extends StateMachineAI implements BattlerA //increase weight of selected buff category PlayerController.buffPool.push(buff.category); - + //add buff to array of applied buffs + PlayerController.appliedBuffs.push(buff); // TODO let item = this.inventory.getItem(); switch(buff.type){ @@ -456,8 +456,7 @@ export default class PlayerController extends StateMachineAI implements BattlerA this.speed += buff.value; break; case BuffType.DEF: - this.CURRENT_BUFFS.def += buff.value; - this.CURRENT_DEF += buff.value; + this.damage_multiplier *= (1-buff.value); break; case BuffType.RANGE: this.CURRENT_BUFFS.range += buff.value; @@ -511,8 +510,20 @@ export default class PlayerController extends StateMachineAI implements BattlerA this.CURRENT_HP = 1; this.CURRENT_ATK *= 100; break; - } } + } + + /** + * + * @returns record of the player stats + */ + getStats(): Record{ + let stats = {} as Record; + stats.current_health = this.CURRENT_HP; + + + return + } } \ No newline at end of file diff --git a/src/shattered_sword/Scenes/GameLevel.ts b/src/shattered_sword/Scenes/GameLevel.ts index 775d333..2ab2926 100644 --- a/src/shattered_sword/Scenes/GameLevel.ts +++ b/src/shattered_sword/Scenes/GameLevel.ts @@ -152,13 +152,14 @@ export default class GameLevel extends Scene { this.load.image("knife", "shattered_sword_assets/sprites/knife.png"); - this.load.spritesheet("slice", "shattered_sword_assets/spritesheets/slice.json"); this.load.image("inventorySlot", "shattered_sword_assets/sprites/inventory.png"); this.load.image("black", "shattered_sword_assets/images/black.png"); this.load.image("poisoning", "shattered_sword_assets/images/poisoning.png"); this.load.image("burning", "shattered_sword_assets/images/burning.png"); this.load.image("bleeding", "shattered_sword_assets/images/bleeding.png"); - + + //TODO - choose spritesheet for slice - modify the slice.json + this.load.spritesheet("slice", "shattered_sword_assets/spritesheets/slice.json"); this.load.spritesheet("test_dummy","shattered_sword_assets/spritesheets/test_dummy.json") this.enemies = new Array(); this.battleManager = new BattleManager(); @@ -418,6 +419,7 @@ export default class GameLevel extends Scene { } //TODO - this is for testing + /* if(InputWrapper.isSpawnJustPressed()){ console.log("trying to spawn enemy"); this.addEnemy("test_dummy",this.player.position,{player: this.player, @@ -431,6 +433,7 @@ export default class GameLevel extends Scene { weapon : this.createWeapon("knife") }); } + */ if (InputWrapper.isInventoryJustPressed()) { console.log("LoadingStory"); @@ -878,8 +881,8 @@ export default class GameLevel extends Scene { actions: actionsDefault, status: statusArray, goal: Statuses.REACHED_GOAL, - size: new Vec2(16,16), - offset : new Vec2(0, 16), + size: new Vec2(14,10), + offset : new Vec2(0, 22), exp: 50, weapon : this.createWeapon("knife"), }) @@ -918,8 +921,8 @@ export default class GameLevel extends Scene { //actions:actions, goal: Statuses.REACHED_GOAL, scale: .25, - size: new Vec2(16,16), - offset : new Vec2(0,0), + size: new Vec2(16,10), + offset : new Vec2(0,6), exp: 50, weapon : this.createWeapon("knife"), actions: actionsDefault, diff --git a/src/shattered_sword/Scenes/Tutorial.ts b/src/shattered_sword/Scenes/Tutorial.ts index 6a3dd73..4a93155 100644 --- a/src/shattered_sword/Scenes/Tutorial.ts +++ b/src/shattered_sword/Scenes/Tutorial.ts @@ -37,15 +37,15 @@ export default class Tutorial extends GameLevel { super.updateScene(deltaT); //spawn snake() - if(Math.random() < .001){ + if(Math.random() < .0001){ console.log("RANDOM SNAKE!"); this.addEnemy("Snake", this.player.position.clone().add(new Vec2(0,-320)),{ player: this.player, health: 50, tilemap: "Main", goal: Statuses.REACHED_GOAL, - size: new Vec2(16,16), - offset : new Vec2(0, 16), + size: new Vec2(14,10), + offset : new Vec2(0, 22), exp: 50, actions: [new AttackAction(3, [Statuses.IN_RANGE], [Statuses.REACHED_GOAL]), new Move(2, [], [Statuses.IN_RANGE], {inRange: 60})],