diff --git a/src/shattered_sword/GameSystems/BattleManager.ts b/src/shattered_sword/GameSystems/BattleManager.ts index ed7afc2..140e82b 100644 --- a/src/shattered_sword/GameSystems/BattleManager.ts +++ b/src/shattered_sword/GameSystems/BattleManager.ts @@ -17,8 +17,7 @@ export default class BattleManager { if(this.enemies.length != 0){ for (let enemy of this.enemies) { if (weapon.hits(enemy.owner)) { - enemy.damage(weapon.type.damage); - + enemy.damage(weapon.type.damage + weapon.EXTRA_DAMAGE); //console.log("enemy took dmg"); } } diff --git a/src/shattered_sword/GameSystems/items/Weapon.ts b/src/shattered_sword/GameSystems/items/Weapon.ts index 038ff88..b62c9e1 100644 --- a/src/shattered_sword/GameSystems/items/Weapon.ts +++ b/src/shattered_sword/GameSystems/items/Weapon.ts @@ -25,6 +25,10 @@ export default class Weapon extends Item { /** The cooldown timer for this weapon's use */ cooldownTimer: Timer; + EXTRA_DAMAGE : number; //flat extra damage value + + EXTRA_RANGE: number ; //percentage value -> .1 = 10% extra range + constructor(sprite: Sprite, type: WeaponType, battleManager: BattleManager){ super(sprite); @@ -42,6 +46,8 @@ export default class Weapon extends Item { // Create the cooldown timer this.cooldownTimer = new Timer(type.cooldown); + this.EXTRA_DAMAGE = 0; + this.EXTRA_RANGE=0; } // @override @@ -58,7 +64,7 @@ export default class Weapon extends Item { this.assets = this.type.createRequiredAssets(this.sprite.getScene()); // Do a type specific weapon animation - this.type.doAnimation(user, direction, ...this.assets); + this.type.doAnimation(user, direction, this.EXTRA_RANGE, ...this.assets); // Apply damage this.battleManager.handleInteraction(userType, this); diff --git a/src/shattered_sword/GameSystems/items/WeaponTypes/Slice.ts b/src/shattered_sword/GameSystems/items/WeaponTypes/Slice.ts index 49413da..49f2040 100644 --- a/src/shattered_sword/GameSystems/items/WeaponTypes/Slice.ts +++ b/src/shattered_sword/GameSystems/items/WeaponTypes/Slice.ts @@ -15,7 +15,12 @@ export default class Slice extends WeaponType { this.useVolume = options.useVolume; } - doAnimation(attacker: GameNode, direction: Vec2, sliceSprite: AnimatedSprite): void { + doAnimation(attacker: GameNode, direction: Vec2, extraRange:number,sliceSprite: AnimatedSprite): void { + //TODO- + //4 to scale up the default sprite - may be different later depending on atk anim + sliceSprite.scaleX = 4*(1+extraRange); //might have to add extra range to y as well + sliceSprite.scaleY = 4; + // Rotate this with the game node // TODO - need to rotate the anim properly sliceSprite.rotation = attacker.rotation; @@ -24,8 +29,7 @@ export default class Slice extends WeaponType { //scale = num of pixels between center of sprite and atk anim sliceSprite.position = attacker.position.clone().add(direction.scaled(65)); - sliceSprite.scaleX = 4; - sliceSprite.scaleY = 4; + // Play the slice animation w/o loop, but queue the normal animation sliceSprite.animation.play("SLICE"); sliceSprite.animation.queue("NORMAL", true); diff --git a/src/shattered_sword/Player/PlayerController.ts b/src/shattered_sword/Player/PlayerController.ts index 8985af4..4367b16 100644 --- a/src/shattered_sword/Player/PlayerController.ts +++ b/src/shattered_sword/Player/PlayerController.ts @@ -15,6 +15,7 @@ import InventoryManager from "../GameSystems/InventoryManager"; import Input from "../../Wolfie2D/Input/Input"; import BattlerAI from "../AI/BattlerAI"; import MathUtils from "../../Wolfie2D/Utils/MathUtils"; +import Weapon from "../GameSystems/items/Weapon"; export enum PlayerType { @@ -115,8 +116,11 @@ export default class PlayerController extends StateMachineAI implements BattlerA this.CURRENT_HP += buff.value; break; case BuffType.ATK: - //TODO - may have to modify the weapon dmg value here instead + //TODO - decide what to do with atk stat this.CURRENT_BUFFS.atk += buff.value; + if (item) { + (item).EXTRA_DAMAGE += buff.value; + } break; case BuffType.SPEED: this.CURRENT_BUFFS.speed += buff.value; @@ -127,7 +131,7 @@ export default class PlayerController extends StateMachineAI implements BattlerA case BuffType.RANGE: this.CURRENT_BUFFS.range += buff.value; if (item) { - //item.sprite. + (item).EXTRA_RANGE += buff.value; } break; } @@ -149,7 +153,9 @@ export default class PlayerController extends StateMachineAI implements BattlerA this.CURRENT_BUFFS = {hp:0, atk:0, def:0, speed:0, range:0}; + //to test the buffs this.addBuff( {type:BuffType.HEALTH, value:1, bonus:false} ); + this.addBuff( {type:BuffType.RANGE, value:1, bonus:false} ); } initializePlatformer(): void {