-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
177 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { DisplayObject } from "pixi.js"; | ||
import { Instances } from "../../lib/game-engine/instances"; | ||
import { mxnRpgStatus } from "./mxn-rpg-status"; | ||
import { RpgAttack } from "../rpg/rpg-attack"; | ||
import { RpgEnemy } from "../rpg/rpg-enemy"; | ||
|
||
interface MxnProjectileArgs { | ||
attack: RpgAttack.Model; | ||
enemy?: RpgEnemy.Model; | ||
} | ||
|
||
export function mxnProjectile(obj: DisplayObject, args: MxnProjectileArgs) { | ||
return obj | ||
.dispatches<'hit'>() | ||
.step(self => { | ||
for (const instance of Instances(mxnRpgStatus)) { | ||
// TODO filter by faction here pls | ||
if (obj.collidesOne(instance.hurtboxes)) { | ||
const result = instance.damage(args.attack); | ||
if (!result.rejected) | ||
self.dispatch('hit'); | ||
if (self.destroyed) | ||
return; | ||
} | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Integer } from "../../lib/math/number-alias-types"; | ||
import { RpgFaction } from "./rpg-faction"; | ||
|
||
export namespace RpgAttack { | ||
export interface Model { | ||
physical: Integer; | ||
emotional: Integer; | ||
poison: Integer; | ||
versus: RpgFaction; | ||
} | ||
|
||
export function create(model: Partial<Model>): Model { | ||
return { | ||
physical: model.physical ?? 0, | ||
emotional: model.emotional ?? 0, | ||
poison: model.poison ?? 0, | ||
versus: model.versus ?? RpgFaction.Player, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export enum RpgFaction { | ||
Player, | ||
Enemy, | ||
Anyone, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.