mirror of
https://github.com/HigherOrderCO/Kind1.git
synced 2024-09-11 08:45:32 +03:00
Status updated
This commit is contained in:
parent
92997a6e42
commit
96a4d0226b
@ -26,10 +26,10 @@ App.GG.Actions.add(action: App.GG.Actions.Data, creature: App.GG.Creature): App.
|
||||
let new_actions = actions@next <- some(action)
|
||||
creature@actions <- new_actions
|
||||
|
||||
App.GG.Actions.stun(status: App.GG.Creature.Status, animation: App.GG.Animation, duration: U64): App.GG.Actions.Data
|
||||
App.GG.Actions.stun(stun: App.GG.Creature.Status.Stun, animation: App.GG.Animation, duration: U64): App.GG.Actions.Data
|
||||
let frame = 0#64
|
||||
let category = App.GG.Actions.Category.stun
|
||||
let effect = App.GG.Effect.stun(status, animation, duration)
|
||||
let effect = App.GG.Effect.stun(stun, animation, duration)
|
||||
App.GG.Actions.Data.new(frame, effect, category)
|
||||
|
||||
App.GG.Actions.new_actions(coord: App.GG.Coord, grid: App.GG.Grid, new_current: App.GG.Actions.Data): App.GG.Grid
|
||||
|
@ -27,7 +27,7 @@ type App.GG.Body.Parts {
|
||||
}
|
||||
|
||||
App.GG.Body.Components.upper: App.GG.Body.Components
|
||||
[App.GG.Components.panel_steal]
|
||||
[App.GG.Components.recursive_gun]
|
||||
|
||||
App.GG.Body.Components.lower: App.GG.Body.Components
|
||||
[App.GG.Components.pull_sword]
|
||||
|
@ -112,4 +112,25 @@ App.GG.Coord.first_enemy_tile(coord: App.GG.Coord, team: App.GG.Team, grid: App.
|
||||
if App.GG.Team.eql(team, front_tile@owner) then
|
||||
App.GG.Coord.first_enemy_tile(front_coord, team, grid)
|
||||
else
|
||||
some(front_coord)
|
||||
some(front_coord)
|
||||
|
||||
// returns all the coords in a coord's column, and all the columns ahead of it
|
||||
App.GG.Coord.self_and_front_columns(coord: App.GG.Coord, grid: App.GG.Grid): List<App.GG.Coord>
|
||||
let tile = App.GG.Grid.get(coord, grid)
|
||||
without tile: []
|
||||
let team = tile@owner
|
||||
App.GG.Coord.self_and_front_columns.go(coord, team, grid)
|
||||
|
||||
App.GG.Coord.self_and_front_columns.go(coord: App.GG.Coord, team: App.GG.Team, grid: App.GG.Grid): List<App.GG.Coord>
|
||||
let list =
|
||||
[{coord@fst, 0#32}, {coord@fst, 1#32}, {coord@fst, 2#32}]
|
||||
let exists = true
|
||||
for c in list with exists:
|
||||
let tile = App.GG.Grid.get(c, grid)
|
||||
without tile: false
|
||||
exists
|
||||
if exists then
|
||||
App.GG.Coord.self_and_front_columns.go(App.GG.Coord.front(coord, team), team, grid) ++ list
|
||||
else
|
||||
[]
|
||||
|
||||
|
@ -4,7 +4,7 @@ type App.GG.Creature {
|
||||
team: App.GG.Team
|
||||
animation: Pair<App.GG.Animation, U64>
|
||||
actions: App.GG.Actions
|
||||
status: List<App.GG.Creature.Status>
|
||||
statuses: App.GG.Creature.Statuses
|
||||
hp: I32
|
||||
id: Nat
|
||||
)
|
||||
@ -83,231 +83,322 @@ App.GG.Creature.get(
|
||||
//===========================================================
|
||||
//Status Management
|
||||
|
||||
|
||||
type App.GG.Creature.Status {
|
||||
flinch
|
||||
invulnerable(duration: U64)
|
||||
noname(duration: U64)
|
||||
poison(duration: U64, damage: I32)
|
||||
root(duration: U64)
|
||||
stun
|
||||
type App.GG.Creature.Statuses {
|
||||
new(
|
||||
poison: Maybe<App.GG.Creature.Status>
|
||||
stun: Maybe<App.GG.Creature.Status>
|
||||
)
|
||||
}
|
||||
|
||||
App.GG.Creature.status_update(
|
||||
creature: App.GG.Creature
|
||||
): App.GG.Creature
|
||||
|
||||
let status_update = App.GG.Creature.status_update_aux(creature@status)
|
||||
creature@status <- status_update
|
||||
type App.GG.Creature.Status {
|
||||
// invulnerable(duration: U64)
|
||||
// intangible(duration: U64)
|
||||
// poison(duration: U64, damage: I32)
|
||||
// root(duration: U64)
|
||||
poison(duration: U64, damage: I32)
|
||||
stun(category: App.GG.Creature.Status.Stun)
|
||||
}
|
||||
|
||||
App.GG.Creature.status_update_aux(
|
||||
status: List<App.GG.Creature.Status>
|
||||
):List<App.GG.Creature.Status>
|
||||
App.GG.Creature.Statuses.pure: App.GG.Creature.Statuses
|
||||
App.GG.Creature.Statuses.new(none, none)
|
||||
|
||||
case status {
|
||||
nil:
|
||||
[]
|
||||
cons:
|
||||
let head = case status.head {
|
||||
flinch: App.GG.Creature.Status.flinch
|
||||
invulnerable: App.GG.Creature.Status.invulnerable(status.head.duration - 1)
|
||||
noname: App.GG.Creature.Status.noname(status.head.duration -1)
|
||||
poison: App.GG.Creature.Status.poison(status.head.duration - 1, status.head.damage)
|
||||
root: App.GG.Creature.Status.root(status.head.duration - 1)
|
||||
stun: App.GG.Creature.Status.stun
|
||||
type App.GG.Creature.Status.Stun {
|
||||
flinch
|
||||
shock
|
||||
}
|
||||
|
||||
}
|
||||
let tail = App.GG.Creature.status_update_aux(status.tail)
|
||||
case head {
|
||||
flinch: head & tail
|
||||
invulnerable: if U64.gtn(head.duration, 0) then head & tail else tail
|
||||
noname: head & tail
|
||||
poison: if U64.gtn(head.duration, 0) then head & tail else tail
|
||||
root: if U64.gtn(head.duration, 0) then head & tail else tail
|
||||
stun: head & tail
|
||||
}
|
||||
}
|
||||
App.GG.Creature.Status.del_from_nat(count: Nat, creature: App.GG.Creature): App.GG.Creature
|
||||
let statuses = creature@statuses
|
||||
let new_statuses =
|
||||
switch Nat.eql(count) {
|
||||
0: statuses@poison <- none
|
||||
1: statuses@stun <- none
|
||||
}default statuses
|
||||
creature@statuses <- new_statuses
|
||||
|
||||
|
||||
App.GG.Creature.add_status(
|
||||
status: App.GG.Creature.Status
|
||||
creature: App.GG.Creature
|
||||
): App.GG.Creature
|
||||
|
||||
let invul = App.GG.Creature.status_check_invulnerable(creature)
|
||||
if invul then
|
||||
case status {
|
||||
invulnerable: App.GG.Creature.status_add_invulnerable(creature, status.duration)
|
||||
}default creature
|
||||
else
|
||||
App.GG.Creature.Status.add(status: App.GG.Creature.Status, creature: App.GG.Creature): App.GG.Creature
|
||||
let statuses = creature@statuses
|
||||
let new_statuses =
|
||||
case status {
|
||||
flinch: App.GG.Creature.status_add_flinch(creature)
|
||||
invulnerable: App.GG.Creature.status_add_invulnerable(creature, status.duration)
|
||||
noname: App.GG.Creature.status_add_noname(creature, status.duration)
|
||||
poison: App.GG.Creature.status_add_poison(creature, status.duration, status.damage)
|
||||
root:App.GG.Creature.status_add_root(creature, status.duration)
|
||||
stun: App.GG.Creature.status_add_stun(creature)
|
||||
poison: statuses@poison <- some(status)
|
||||
stun: statuses@stun <- some(status)
|
||||
}
|
||||
creature@statuses <- new_statuses
|
||||
|
||||
App.GG.Creature.Status.get_from_nat(count: Nat, statuses: App.GG.Creature.Statuses): Maybe<Maybe<App.GG.Creature.Status>>
|
||||
switch Nat.eql(count) {
|
||||
0: some(statuses@poison)
|
||||
1: some(statuses@stun)
|
||||
}default none
|
||||
|
||||
App.GG.Creature.status_add_flinch(
|
||||
creature: App.GG.Creature
|
||||
): App.GG.Creature
|
||||
|
||||
let new_status = App.GG.Creature.Status.flinch & creature@status
|
||||
creature@status <- new_status
|
||||
App.GG.Creature.Status.update_grid(coord: App.GG.Coord, grid: App.GG.Grid): App.GG.Grid
|
||||
App.GG.Creature.Status.update_grid.go(0, coord, grid)
|
||||
|
||||
App.GG.Creature.status_add_invulnerable(
|
||||
creature: App.GG.Creature
|
||||
duration: U64
|
||||
): App.GG.Creature
|
||||
|
||||
let new_status = App.GG.Creature.status_add_invulnerable_aux(duration, creature@status)
|
||||
creature@status <- new_status
|
||||
App.GG.Creature.Status.update_grid.go(count: Nat, coord: App.GG.Coord, grid: App.GG.Grid): App.GG.Grid
|
||||
let new_grid =
|
||||
Maybe {
|
||||
get creature = App.GG.Creature.get(coord, grid)
|
||||
let statuses = creature@statuses
|
||||
get status = App.GG.Creature.Status.get_from_nat(count, statuses)
|
||||
let new_grid =
|
||||
without status: grid
|
||||
case status {
|
||||
poison: App.GG.Creature.Status.update_poison(status, coord, grid)
|
||||
stun: App.GG.Creature.Status.update_stun(status, coord, grid)
|
||||
}default grid
|
||||
let new_grid = App.GG.Creature.Status.update_grid.go(count +1, coord, new_grid)
|
||||
return new_grid
|
||||
} <> grid
|
||||
new_grid
|
||||
|
||||
App.GG.Creature.status_add_invulnerable_aux(
|
||||
duration: U64
|
||||
status: List<App.GG.Creature.Status>
|
||||
): List<App.GG.Creature.Status>
|
||||
|
||||
let new_invul = App.GG.Creature.Status.invulnerable(duration)
|
||||
App.GG.Creature.Status.update_poison(status: App.GG.Creature.Status, coord: App.GG.Coord, grid: App.GG.Grid): App.GG.Grid
|
||||
case status {
|
||||
nil: new_invul & status
|
||||
cons:
|
||||
case status.head {
|
||||
invulnerable:
|
||||
if U64.gtn(status.head.duration, duration) then
|
||||
status
|
||||
else
|
||||
new_invul & status.tail
|
||||
}default status.head & App.GG.Creature.status_add_invulnerable_aux(duration, status.tail)
|
||||
}
|
||||
poison:
|
||||
log(U64.show(status.duration))
|
||||
let new_grid =
|
||||
if status.duration =? 0 then
|
||||
let new_creature = App.GG.Creature.Status.del_from_nat(0)
|
||||
let new_grid = App.GG.Creature.modify_at(new_creature, coord, grid)
|
||||
new_grid
|
||||
else
|
||||
let new_creature = App.GG.Creature.Status.add(App.GG.Creature.Status.poison(status.duration - 1, status.damage))
|
||||
let new_grid = App.GG.Creature.modify_at(new_creature, coord, grid)
|
||||
new_grid
|
||||
if (status.duration % 10) =? 0 then
|
||||
let eff = App.GG.Effect.creature.change_hp_at(status.damage, coord, false)
|
||||
let result = eff(coord, App.GG.Effect.Origin.creature, new_grid)
|
||||
case result {err: new_grid, new: result.grid}
|
||||
else
|
||||
new_grid
|
||||
}default grid
|
||||
|
||||
|
||||
App.GG.Creature.status_check_invulnerable(
|
||||
creature: App.GG.Creature
|
||||
): Bool
|
||||
let status = creature@status
|
||||
case status {
|
||||
invulnerable: true
|
||||
}default false
|
||||
|
||||
|
||||
App.GG.Creature.status_add_noname(
|
||||
creature: App.GG.Creature
|
||||
duration: U64
|
||||
): App.GG.Creature
|
||||
|
||||
let new_status = App.GG.Creature.status_add_noname_aux(duration, creature@status)
|
||||
creature@status <- new_status
|
||||
|
||||
|
||||
App.GG.Creature.status_add_noname_aux(
|
||||
duration: U64
|
||||
status: List<App.GG.Creature.Status>
|
||||
): List<App.GG.Creature.Status>
|
||||
|
||||
let new_noname = App.GG.Creature.Status.noname(duration)
|
||||
App.GG.Creature.Status.update_stun(status: App.GG.Creature.Status, coord: App.GG.Coord, grid: App.GG.Grid): App.GG.Grid
|
||||
case status {
|
||||
nil: new_noname & status
|
||||
cons:
|
||||
case status.head {
|
||||
noname:
|
||||
if U64.gtn(status.head.duration, duration) then
|
||||
status
|
||||
else
|
||||
new_noname & status.tail
|
||||
}default status.head & App.GG.Creature.status_add_noname_aux(duration, status.tail)
|
||||
}
|
||||
|
||||
App.GG.Creature.status_check_noname(
|
||||
creature: App.GG.Creature
|
||||
): Bool
|
||||
let status = creature@status
|
||||
case status {
|
||||
noname: true
|
||||
}default false
|
||||
stun:
|
||||
let new_creature = App.GG.Creature.Status.add(App.GG.Creature.Status.stun(status.category))
|
||||
let new_grid = App.GG.Creature.modify_at(new_creature, coord, grid)
|
||||
new_grid
|
||||
}default grid
|
||||
// New Status
|
||||
|
||||
|
||||
App.GG.Creature.status_add_poison(
|
||||
creature: App.GG.Creature
|
||||
duration: U64
|
||||
damage: I32
|
||||
): App.GG.Creature
|
||||
|
||||
|
||||
// App.GG.Creature.status_update(
|
||||
// creature: App.GG.Creature
|
||||
// ): App.GG.Creature
|
||||
|
||||
let new_status = App.GG.Creature.status_add_poison_aux(duration, damage, creature@status)
|
||||
creature@status <- new_status
|
||||
// let status_update = App.GG.Creature.status_update_aux(creature@status)
|
||||
// creature@status <- status_update
|
||||
|
||||
// App.GG.Creature.status_update_aux(
|
||||
// status: List<App.GG.Creature.Status>
|
||||
// ):List<App.GG.Creature.Status>
|
||||
|
||||
// case status {
|
||||
// nil:
|
||||
// []
|
||||
// cons:
|
||||
// let head = case status.head {
|
||||
// flinch: App.GG.Creature.Status.flinch
|
||||
// invulnerable: App.GG.Creature.Status.invulnerable(status.head.duration - 1)
|
||||
// noname: App.GG.Creature.Status.noname(status.head.duration -1)
|
||||
// poison: App.GG.Creature.Status.poison(status.head.duration - 1, status.head.damage)
|
||||
// root: App.GG.Creature.Status.root(status.head.duration - 1)
|
||||
// stun: App.GG.Creature.Status.stun
|
||||
|
||||
// }
|
||||
// let tail = App.GG.Creature.status_update_aux(status.tail)
|
||||
// case head {
|
||||
// flinch: head & tail
|
||||
// invulnerable: if U64.gtn(head.duration, 0) then head & tail else tail
|
||||
// noname: head & tail
|
||||
// poison: if U64.gtn(head.duration, 0) then head & tail else tail
|
||||
// root: if U64.gtn(head.duration, 0) then head & tail else tail
|
||||
// stun: head & tail
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
App.GG.Creature.status_add_poison_aux(
|
||||
duration: U64
|
||||
damage: I32
|
||||
status: List<App.GG.Creature.Status>
|
||||
): List<App.GG.Creature.Status>
|
||||
// App.GG.Creature.add_status(
|
||||
// status: App.GG.Creature.Status
|
||||
// creature: App.GG.Creature
|
||||
// ): App.GG.Creature
|
||||
|
||||
let new_poison = App.GG.Creature.Status.poison(duration, damage)
|
||||
case status {
|
||||
nil: new_poison & status
|
||||
cons:
|
||||
case status.head {
|
||||
poison:
|
||||
if U64.gtn(status.head.duration, duration) then
|
||||
status
|
||||
else
|
||||
new_poison & status.tail
|
||||
}default status.head & App.GG.Creature.status_add_poison_aux(duration, damage, status.tail)
|
||||
}
|
||||
// let invul = App.GG.Creature.status_check_invulnerable(creature)
|
||||
// if invul then
|
||||
// case status {
|
||||
// invulnerable: App.GG.Creature.status_add_invulnerable(creature, status.duration)
|
||||
// }default creature
|
||||
// else
|
||||
// case status {
|
||||
// flinch: App.GG.Creature.status_add_flinch(creature)
|
||||
// invulnerable: App.GG.Creature.status_add_invulnerable(creature, status.duration)
|
||||
// noname: App.GG.Creature.status_add_noname(creature, status.duration)
|
||||
// poison: App.GG.Creature.status_add_poison(creature, status.duration, status.damage)
|
||||
// root:App.GG.Creature.status_add_root(creature, status.duration)
|
||||
// stun: App.GG.Creature.status_add_stun(creature)
|
||||
// }
|
||||
|
||||
|
||||
App.GG.Creature.status_add_root(
|
||||
creature: App.GG.Creature
|
||||
duration: U64
|
||||
): App.GG.Creature
|
||||
// App.GG.Creature.status_add_flinch(
|
||||
// creature: App.GG.Creature
|
||||
// ): App.GG.Creature
|
||||
|
||||
let new_status = App.GG.Creature.status_add_root_aux(duration, creature@status)
|
||||
creature@status <- new_status
|
||||
// let new_status = App.GG.Creature.Status.flinch & creature@status
|
||||
// creature@status <- new_status
|
||||
|
||||
// App.GG.Creature.status_add_invulnerable(
|
||||
// creature: App.GG.Creature
|
||||
// duration: U64
|
||||
// ): App.GG.Creature
|
||||
|
||||
// let new_status = App.GG.Creature.status_add_invulnerable_aux(duration, creature@status)
|
||||
// creature@status <- new_status
|
||||
|
||||
// App.GG.Creature.status_add_invulnerable_aux(
|
||||
// duration: U64
|
||||
// status: List<App.GG.Creature.Status>
|
||||
// ): List<App.GG.Creature.Status>
|
||||
|
||||
// let new_invul = App.GG.Creature.Status.invulnerable(duration)
|
||||
// case status {
|
||||
// nil: new_invul & status
|
||||
// cons:
|
||||
// case status.head {
|
||||
// invulnerable:
|
||||
// if U64.gtn(status.head.duration, duration) then
|
||||
// status
|
||||
// else
|
||||
// new_invul & status.tail
|
||||
// }default status.head & App.GG.Creature.status_add_invulnerable_aux(duration, status.tail)
|
||||
// }
|
||||
|
||||
|
||||
App.GG.Creature.status_add_root_aux(
|
||||
duration: U64
|
||||
status: List<App.GG.Creature.Status>
|
||||
): List<App.GG.Creature.Status>
|
||||
// App.GG.Creature.status_check_invulnerable(
|
||||
// creature: App.GG.Creature
|
||||
// ): Bool
|
||||
// let status = creature@status
|
||||
// case status {
|
||||
// invulnerable: true
|
||||
// }default false
|
||||
|
||||
let new_root = App.GG.Creature.Status.root(duration)
|
||||
case status {
|
||||
nil: new_root & status
|
||||
cons:
|
||||
case status.head {
|
||||
root:
|
||||
if U64.gtn(status.head.duration, duration) then
|
||||
status
|
||||
else
|
||||
new_root & status.tail
|
||||
}default status.head & App.GG.Creature.status_add_root_aux(duration, status.tail)
|
||||
}
|
||||
|
||||
// App.GG.Creature.status_add_noname(
|
||||
// creature: App.GG.Creature
|
||||
// duration: U64
|
||||
// ): App.GG.Creature
|
||||
|
||||
// let new_status = App.GG.Creature.status_add_noname_aux(duration, creature@status)
|
||||
// creature@status <- new_status
|
||||
|
||||
|
||||
// App.GG.Creature.status_add_noname_aux(
|
||||
// duration: U64
|
||||
// status: List<App.GG.Creature.Status>
|
||||
// ): List<App.GG.Creature.Status>
|
||||
|
||||
// let new_noname = App.GG.Creature.Status.noname(duration)
|
||||
// case status {
|
||||
// nil: new_noname & status
|
||||
// cons:
|
||||
// case status.head {
|
||||
// noname:
|
||||
// if U64.gtn(status.head.duration, duration) then
|
||||
// status
|
||||
// else
|
||||
// new_noname & status.tail
|
||||
// }default status.head & App.GG.Creature.status_add_noname_aux(duration, status.tail)
|
||||
// }
|
||||
|
||||
// App.GG.Creature.status_check_noname(
|
||||
// creature: App.GG.Creature
|
||||
// ): Bool
|
||||
// let status = creature@status
|
||||
// case status {
|
||||
// noname: true
|
||||
// }default false
|
||||
|
||||
|
||||
// App.GG.Creature.status_add_poison(
|
||||
// creature: App.GG.Creature
|
||||
// duration: U64
|
||||
// damage: I32
|
||||
// ): App.GG.Creature
|
||||
|
||||
// let new_status = App.GG.Creature.status_add_poison_aux(duration, damage, creature@status)
|
||||
// creature@status <- new_status
|
||||
|
||||
|
||||
// App.GG.Creature.status_add_poison_aux(
|
||||
// duration: U64
|
||||
// damage: I32
|
||||
// status: List<App.GG.Creature.Status>
|
||||
// ): List<App.GG.Creature.Status>
|
||||
|
||||
// let new_poison = App.GG.Creature.Status.poison(duration, damage)
|
||||
// case status {
|
||||
// nil: new_poison & status
|
||||
// cons:
|
||||
// case status.head {
|
||||
// poison:
|
||||
// if U64.gtn(status.head.duration, duration) then
|
||||
// status
|
||||
// else
|
||||
// new_poison & status.tail
|
||||
// }default status.head & App.GG.Creature.status_add_poison_aux(duration, damage, status.tail)
|
||||
// }
|
||||
|
||||
|
||||
// App.GG.Creature.status_add_root(
|
||||
// creature: App.GG.Creature
|
||||
// duration: U64
|
||||
// ): App.GG.Creature
|
||||
|
||||
// let new_status = App.GG.Creature.status_add_root_aux(duration, creature@status)
|
||||
// creature@status <- new_status
|
||||
|
||||
|
||||
// App.GG.Creature.status_add_root_aux(
|
||||
// duration: U64
|
||||
// status: List<App.GG.Creature.Status>
|
||||
// ): List<App.GG.Creature.Status>
|
||||
|
||||
// let new_root = App.GG.Creature.Status.root(duration)
|
||||
// case status {
|
||||
// nil: new_root & status
|
||||
// cons:
|
||||
// case status.head {
|
||||
// root:
|
||||
// if U64.gtn(status.head.duration, duration) then
|
||||
// status
|
||||
// else
|
||||
// new_root & status.tail
|
||||
// }default status.head & App.GG.Creature.status_add_root_aux(duration, status.tail)
|
||||
// }
|
||||
|
||||
|
||||
App.GG.Creature.status_add_stun(
|
||||
creature: App.GG.Creature
|
||||
): App.GG.Creature
|
||||
// App.GG.Creature.status_add_stun(
|
||||
// creature: App.GG.Creature
|
||||
// ): App.GG.Creature
|
||||
|
||||
let new_status = App.GG.Creature.Status.stun & creature@status
|
||||
creature@status <- new_status
|
||||
// let new_status = App.GG.Creature.Status.stun & creature@status
|
||||
// creature@status <- new_status
|
||||
|
||||
App.GG.Creature.status_eql(a: App.GG.Creature.Status, b: App.GG.Creature.Status): Bool
|
||||
case a b {
|
||||
invulnerable invulnerable: true
|
||||
poison poison: true
|
||||
root root: true
|
||||
stun root: true
|
||||
}default false
|
||||
// App.GG.Creature.status_eql(a: App.GG.Creature.Status, b: App.GG.Creature.Status): Bool
|
||||
// case a b {
|
||||
// invulnerable invulnerable: true
|
||||
// poison poison: true
|
||||
// root root: true
|
||||
// stun root: true
|
||||
// }default false
|
||||
|
||||
App.GG.Creature.status_different(a: App.GG.Creature.Status, b: App.GG.Creature.Status): Bool
|
||||
not(App.GG.Creature.status_eql(a, b))
|
||||
// App.GG.Creature.status_different(a: App.GG.Creature.Status, b: App.GG.Creature.Status): Bool
|
||||
// not(App.GG.Creature.status_eql(a, b))
|
||||
|
||||
App.GG.Creature.del_status(status: App.GG.Creature.Status, creature: App.GG.Creature): App.GG.Creature
|
||||
let new_status = List.filter!(App.GG.Creature.status_different(status), creature@status)
|
||||
creature@status <- new_status
|
||||
// App.GG.Creature.del_status(status: App.GG.Creature.Status, creature: App.GG.Creature): App.GG.Creature
|
||||
// let new_status = List.filter!(App.GG.Creature.status_different(status), creature@status)
|
||||
// creature@status <- new_status
|
||||
|
||||
|
||||
//===========================================================
|
||||
@ -345,7 +436,7 @@ App.GG.Creature.create_slime(slime: App.GG.Slime, grid: App.GG.Grid): App.GG.Cre
|
||||
let team = App.GG.Team.blue
|
||||
let animation = {App.GG.Animation.idle, 0#64}
|
||||
let actions = App.GG.Actions.new(none, none, false)
|
||||
let status = [] :: List<App.GG.Creature.Status>
|
||||
let status = App.GG.Creature.Statuses.pure
|
||||
let id = App.GG.Grid.next_id(grid)
|
||||
let dna = slime@dna
|
||||
let body = dna@body
|
||||
@ -361,7 +452,7 @@ App.GG.Creature.create_minion(minion: App.GG.Minion, grid: App.GG.Grid): App.GG.
|
||||
let team = App.GG.Team.red
|
||||
let animation = {App.GG.Animation.idle, 0#64}
|
||||
let actions = App.GG.Actions.new(none, none, false)
|
||||
let status = [] :: List<App.GG.Creature.Status>
|
||||
let status = App.GG.Creature.Statuses.pure
|
||||
let id = App.GG.Grid.next_id(grid)
|
||||
let AI = App.GG.AI.new(0, 0)
|
||||
let hp = minion@hp
|
||||
|
@ -23,7 +23,7 @@ App.GG.Effect.creature.change_hp_at(dmg: I32, pos: App.GG.Coord, flinch: Bool):
|
||||
let new_grid = App.GG.Grid.set(pos, new_tile, grid)
|
||||
let new_grid =
|
||||
if flinch then
|
||||
let stun = App.GG.Actions.stun(App.GG.Creature.Status.stun, App.GG.Animation.damage, 24)
|
||||
let stun = App.GG.Actions.stun(App.GG.Creature.Status.Stun.flinch, App.GG.Animation.damage, 24)
|
||||
App.GG.Actions.new_actions(pos, new_grid, stun)
|
||||
else
|
||||
new_grid
|
||||
|
@ -73,7 +73,7 @@ App.GG.Effect.projectile.can_hit(coord: App.GG.Coord): App.GG.Effect<Bool>
|
||||
App.GG.Effect {
|
||||
get has_hit = App.GG.Effect.projectile.has_hit(coord) // Checks if projectile has already hit that enemy
|
||||
get is_enemy = App.GG.Effect.creature.is_enemy(coord) // Checks if projectile is over an enemy
|
||||
get is_invulnerable = App.GG.Effect.status.is_invulnerable(coord) // Checks if projectile is trying to affect an invulnerable enemy
|
||||
get is_noname = App.GG.Effect.status.is_noname(coord) // Checks if projectile is trying to affect a creature with noname
|
||||
let is_invulnerable = false //App.GG.Effect.status.is_invulnerable(coord) // Checks if projectile is trying to affect an invulnerable enemy
|
||||
let is_noname = false //App.GG.Effect.status.is_noname(coord) // Checks if projectile is trying to affect a creature with noname
|
||||
return not(is_noname) && not(is_invulnerable) && not(has_hit) && is_enemy
|
||||
}
|
||||
|
@ -1,95 +1,91 @@
|
||||
//TODO
|
||||
App.GG.Effect.status.is_invulnerable(pos: App.GG.Coord): App.GG.Effect<Bool>
|
||||
(center, origin, grid)
|
||||
let bool =
|
||||
Maybe {
|
||||
get creature = App.GG.Creature.get(pos, grid)
|
||||
return App.GG.Creature.status_check_invulnerable(creature)
|
||||
} <> false
|
||||
App.GG.Effect.Result.new!(bool, center, origin, grid, (img) img, 0, "")
|
||||
// //TODO
|
||||
// App.GG.Effect.status.is_invulnerable(pos: App.GG.Coord): App.GG.Effect<Bool>
|
||||
// (center, origin, grid)
|
||||
// let bool =
|
||||
// Maybe {
|
||||
// get creature = App.GG.Creature.get(pos, grid)
|
||||
// return App.GG.Creature.status_check_invulnerable(creature)
|
||||
// } <> false
|
||||
// App.GG.Effect.Result.new!(bool, center, origin, grid, (img) img, 0, "")
|
||||
|
||||
|
||||
App.GG.Effect.status.is_noname(pos: App.GG.Coord): App.GG.Effect<Bool>
|
||||
(center, origin, grid)
|
||||
let bool =
|
||||
Maybe {
|
||||
get creature = App.GG.Creature.get(pos, grid)
|
||||
return App.GG.Creature.status_check_noname(creature)
|
||||
} <> false
|
||||
App.GG.Effect.Result.new!(bool, center, origin, grid, (img) img, 0, "")
|
||||
// App.GG.Effect.status.is_noname(pos: App.GG.Coord): App.GG.Effect<Bool>
|
||||
// (center, origin, grid)
|
||||
// let bool =
|
||||
// Maybe {
|
||||
// get creature = App.GG.Creature.get(pos, grid)
|
||||
// return App.GG.Creature.status_check_noname(creature)
|
||||
// } <> false
|
||||
// App.GG.Effect.Result.new!(bool, center, origin, grid, (img) img, 0, "")
|
||||
|
||||
|
||||
App.GG.Effect.status.add_noname(duration: U64): App.GG.Effect<Unit>
|
||||
App.GG.Effect {
|
||||
get frame = App.GG.Effect.frame.get
|
||||
get center = App.GG.Effect.coord.get_center
|
||||
let status = App.GG.Creature.Status.noname(duration)
|
||||
let mod = App.GG.Creature.modify_at(App.GG.Creature.add_status(status), center)
|
||||
App.GG.Effect.grid.modify(mod)
|
||||
}
|
||||
// App.GG.Effect.status.add_noname(duration: U64): App.GG.Effect<Unit>
|
||||
// App.GG.Effect {
|
||||
// get frame = App.GG.Effect.frame.get
|
||||
// get center = App.GG.Effect.coord.get_center
|
||||
// let status = App.GG.Creature.Status.noname(duration)
|
||||
// let mod = App.GG.Creature.modify_at(App.GG.Creature.add_status(status), center)
|
||||
// App.GG.Effect.grid.modify(mod)
|
||||
// }
|
||||
|
||||
|
||||
App.GG.Effect.status.noname(
|
||||
iframe: Bool
|
||||
): App.GG.Effect<Unit>
|
||||
// App.GG.Effect.status.noname(
|
||||
// iframe: Bool
|
||||
// ): App.GG.Effect<Unit>
|
||||
|
||||
App.GG.Effect {
|
||||
let animation = App.GG.Animation.damage
|
||||
App.GG.Effect.stun(App.GG.Creature.Status.flinch, animation, 24)
|
||||
if iframe then
|
||||
App.GG.Effect.status.add_noname(1)
|
||||
else
|
||||
App.GG.Effect.pass
|
||||
}
|
||||
// App.GG.Effect {
|
||||
// let animation = App.GG.Animation.damage
|
||||
// App.GG.Effect.stun(App.GG.Creature.Status.flinch, animation, 24)
|
||||
// if iframe then
|
||||
// App.GG.Effect.status.add_noname(1)
|
||||
// else
|
||||
// App.GG.Effect.pass
|
||||
// }
|
||||
|
||||
App.GG.Effect.status.add_at(
|
||||
status: App.GG.Creature.Status
|
||||
pos: App.GG.Coord
|
||||
): App.GG.Effect<Unit>
|
||||
let status_add = App.GG.Creature.Status.add(status)
|
||||
let mod = App.GG.Creature.modify_at(status_add, pos)
|
||||
App.GG.Effect.grid.modify(mod)
|
||||
|
||||
|
||||
// App.GG.Effect.status.add_poison_at(
|
||||
// damage: I32
|
||||
// duration: U64
|
||||
// pos: App.GG.Coord
|
||||
// ): App.GG.Effect<Unit>
|
||||
|
||||
// App.GG.Effect {
|
||||
// get creature = App.GG.Effect.creature.get_at(pos)
|
||||
// without creature: App.GG.Effect.pass
|
||||
// let poison = App.GG.Creature.Status.poison(duration, damage)
|
||||
// App.GG.Effect.status.add_at(poison, pos)
|
||||
// }
|
||||
|
||||
// App.GG.Effect.status.poison_apply_at(
|
||||
// damage: I32
|
||||
// duration: U64
|
||||
// pos: App.GG.Coord
|
||||
// ): App.GG.Effect<I32>
|
||||
|
||||
App.GG.Effect {
|
||||
get grid = App.GG.Effect.grid.get
|
||||
let status_add = App.GG.Creature.add_status(status)
|
||||
let mod = App.GG.Creature.modify_at(status_add, pos)
|
||||
App.GG.Effect.grid.modify(mod)
|
||||
}
|
||||
// App.GG.Effect {
|
||||
// if duration >? 0 then
|
||||
// App.GG.Effect.creature.damage_at(damage, pos, false)
|
||||
// else
|
||||
// App.GG.Effect { return +0#32 }
|
||||
// }
|
||||
|
||||
|
||||
App.GG.Effect.status.add_poison_at(
|
||||
damage: I32
|
||||
duration: U64
|
||||
pos: App.GG.Coord
|
||||
): App.GG.Effect<Unit>
|
||||
|
||||
App.GG.Effect {
|
||||
get creature = App.GG.Effect.creature.get_at(pos)
|
||||
without creature: App.GG.Effect.pass
|
||||
let poison = App.GG.Creature.Status.poison(duration, damage)
|
||||
App.GG.Effect.status.add_at(poison, pos)
|
||||
}
|
||||
|
||||
App.GG.Effect.status.poison_apply_at(
|
||||
damage: I32
|
||||
duration: U64
|
||||
pos: App.GG.Coord
|
||||
): App.GG.Effect<I32>
|
||||
// App.GG.Effect.status.apply_ot(
|
||||
// creature: App.GG.Creature
|
||||
// ): App.GG.Effect<Unit>
|
||||
|
||||
App.GG.Effect {
|
||||
if duration >? 0 then
|
||||
App.GG.Effect.creature.damage_at(damage, pos, false)
|
||||
else
|
||||
App.GG.Effect { return +0#32 }
|
||||
}
|
||||
|
||||
App.GG.Effect.status.apply_ot(
|
||||
creature: App.GG.Creature
|
||||
): App.GG.Effect<Unit>
|
||||
|
||||
App.GG.Effect {
|
||||
let status = creature@status
|
||||
case status {
|
||||
poison: App.GG.Effect.creature.damage_at(status.head.damage, status.head.duration, false)
|
||||
}default App.GG.Effect.pass
|
||||
}
|
||||
// App.GG.Effect {
|
||||
// let status = creature@status
|
||||
// case status {
|
||||
// poison: App.GG.Effect.creature.damage_at(status.head.damage, status.head.duration, false)
|
||||
// }default App.GG.Effect.pass
|
||||
// }
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
App.GG.Effect.stun(status: App.GG.Creature.Status, animation: App.GG.Animation, duration: U64): App.GG.Effect<Unit>
|
||||
App.GG.Effect.stun(status: App.GG.Creature.Status.Stun, animation: App.GG.Animation, duration: U64): App.GG.Effect<Unit>
|
||||
App.GG.Effect {
|
||||
get frame = App.GG.Effect.frame.get
|
||||
get center = App.GG.Effect.coord.get_center
|
||||
@ -8,13 +8,13 @@ App.GG.Effect.stun(status: App.GG.Creature.Status, animation: App.GG.Animation,
|
||||
switch U64.eql(frame) {
|
||||
0 :
|
||||
App.GG.Effect {
|
||||
let mod = App.GG.Creature.modify_at(App.GG.Creature.add_status(status), center)
|
||||
let mod = App.GG.Creature.modify_at(App.GG.Creature.Status.add(App.GG.Creature.Status.stun(status)), center)
|
||||
App.GG.Effect.grid.modify(mod)
|
||||
App.GG.Effect.animation.update(animation)
|
||||
}
|
||||
duration:
|
||||
App.GG.Effect {
|
||||
let mod = App.GG.Creature.modify_at(App.GG.Creature.del_status(status), center)
|
||||
let mod = App.GG.Creature.modify_at(App.GG.Creature.Status.add(App.GG.Creature.Status.stun(status)), center)
|
||||
App.GG.Effect.grid.modify(mod)
|
||||
App.GG.Effect.actions.del
|
||||
App.GG.Effect.animation.update(App.GG.Animation.idle)
|
||||
|
@ -101,11 +101,15 @@ App.GG.Tile.Status.update_stolen(status: App.GG.Tile.Status, coord: App.GG.Coord
|
||||
stolen:
|
||||
log(U64.show(status.duration))
|
||||
if status.duration =? 0 then
|
||||
let new_tile = App.GG.Tile.original_owner.update(coord)
|
||||
let new_grid = App.GG.Grid.update(coord, new_tile, grid)
|
||||
let new_tile = App.GG.Tile.Status.del_from_nat(0)
|
||||
let new_grid = App.GG.Grid.update(coord, new_tile, new_grid)
|
||||
new_grid
|
||||
let can_rtrn = App.GG.Tile.can_be_returned(coord, grid)
|
||||
if can_rtrn then
|
||||
let new_tile = App.GG.Tile.original_owner.update(coord)
|
||||
let new_grid = App.GG.Grid.update(coord, new_tile, grid)
|
||||
let new_tile = App.GG.Tile.Status.del_from_nat(0)
|
||||
let new_grid = App.GG.Grid.update(coord, new_tile, new_grid)
|
||||
new_grid
|
||||
else
|
||||
grid
|
||||
else
|
||||
let new_tile = App.GG.Tile.Status.add(App.GG.Tile.Status.stolen(status.duration - 1))
|
||||
let new_grid = App.GG.Grid.update(coord, new_tile, grid)
|
||||
@ -114,14 +118,29 @@ App.GG.Tile.Status.update_stolen(status: App.GG.Tile.Status, coord: App.GG.Coord
|
||||
|
||||
App.GG.Tile.Status.update_broken(status: App.GG.Tile.Status, coord: App.GG.Coord, grid: App.GG.Grid): App.GG.Grid
|
||||
case status {
|
||||
stolen:
|
||||
broken:
|
||||
if status.duration =? 0 then
|
||||
let new_tile = App.GG.Tile.Status.del_from_nat(1)
|
||||
let new_grid = App.GG.Grid.update(coord, new_tile, grid)
|
||||
new_grid
|
||||
else
|
||||
let new_tile = App.GG.Tile.Status.add(App.GG.Tile.Status.stolen(status.duration - 1))
|
||||
let new_tile = App.GG.Tile.Status.add(App.GG.Tile.Status.broken(status.duration - 1))
|
||||
let new_grid = App.GG.Grid.update(coord, new_tile, grid)
|
||||
new_grid
|
||||
}default grid
|
||||
// New Status
|
||||
|
||||
App.GG.Tile.can_be_returned(coord: App.GG.Coord, grid: App.GG.Grid): Bool
|
||||
let coords = App.GG.Coord.self_and_front_columns(coord, grid)
|
||||
let tile = App.GG.Grid.get(coord, grid)
|
||||
without tile: false
|
||||
let team = tile@owner
|
||||
let can_return = true
|
||||
for c in coords with can_return:
|
||||
let creature = App.GG.Creature.get(c, grid)
|
||||
without creature: can_return
|
||||
if App.GG.Team.eql(tile@owner, creature@team) then
|
||||
false
|
||||
else
|
||||
can_return
|
||||
can_return
|
||||
|
@ -437,6 +437,8 @@ App.GG.when.update_tile.run(coord: App.GG.Coord, grid: App.GG.Grid): App.GG.Grid
|
||||
let new_grid = App.GG.Projectile.run(coord, new_grid)
|
||||
// Runs the tile statuses
|
||||
let new_grid = App.GG.Tile.Status.update_grid(coord, new_grid)
|
||||
// Runs Creature's Status
|
||||
let new_grid = App.GG.Creature.Status.update_grid(coord, new_grid)
|
||||
new_grid
|
||||
|
||||
// Adds the basic Attack action to the creature's next action
|
||||
|
Loading…
Reference in New Issue
Block a user