move kiss behavior of blades data into haxe files

This commit is contained in:
2022-06-08 02:22:41 +00:00
parent 03e52e954d
commit 434dba3866
4 changed files with 90 additions and 89 deletions

View File

@@ -3,6 +3,7 @@ package data.blades;
using Type;
using Reflect;
import kiss.Prelude;
import kiss.Kiss;
enum MeleeAbility {
Poison;
@@ -114,7 +115,6 @@ typedef Strategy = {
persistentTarget: Bool
};
@:build(kiss.Kiss.build())
class CreatureData {
public function new() {}
@@ -133,6 +133,48 @@ class CreatureData {
public var sp_bonus = 0;
private var special_abil = 0;
// specialAbility() defined in kiss file
public function specialAbility() {
return Kiss.exp('(case special_abil
(0 None)
(1 (Melee Poison))
(2 (Ray CurseAndWeaken))
(3 (Ray TurnToStone))
(4 (Melee Slow))
(5 (Throw Web4))
(6 (Melee Disease))
(7 (Ray Charm))
(8 (Melee Sleep))
(9 (Ray Sleep))
(10 (Melee Paralyze))
(11 (Ray Paralyze))
(12 (Melee Acid))
(13 (Ray DrainSP))
(14 (Ray Confuse))
(15 (Ray Terrify))
(16 (Throw Rocks))
(17 (Breath Fire))
(18 (Breath Cold))
(19 (Breath Acid))
(20 (Melee Fire))
(21 (Melee Cold))
(22 (Melee DrainXP))
(23 (Melee ColdDrainXP))
(24 Invisible)
(26 (Radiate Fire))
(27 (Radiate Cold))
(28 (Radiate AntiMagic))
(29 SplitsWhenHit)
(30 (Ray Fire))
(32 (Ray MagicDamage))
(33 (Breath Darkness))
(34 (Throw Spines))
(35 ForceCage)
(36 (Melee Web))
(37 (Radiate Sleep))
(38 (Radiate Stink))
(39 (Radiate Blade))
(otherwise (throw "undefined special_abil")))');
}
private var default_attitude = 2;
public function defaultAttitude() {

View File

@@ -1,41 +0,0 @@
(method specialAbility []
(case special_abil
(0 None)
(1 (Melee Poison))
(2 (Ray CurseAndWeaken))
(3 (Ray TurnToStone))
(4 (Melee Slow))
(5 (Throw Web4))
(6 (Melee Disease))
(7 (Ray Charm))
(8 (Melee Sleep))
(9 (Ray Sleep))
(10 (Melee Paralyze))
(11 (Ray Paralyze))
(12 (Melee Acid))
(13 (Ray DrainSP))
(14 (Ray Confuse))
(15 (Ray Terrify))
(16 (Throw Rocks))
(17 (Breath Fire))
(18 (Breath Cold))
(19 (Breath Acid))
(20 (Melee Fire))
(21 (Melee Cold))
(22 (Melee DrainXP))
(23 (Melee ColdDrainXP))
(24 Invisible)
(26 (Radiate Fire))
(27 (Radiate Cold))
(28 (Radiate AntiMagic))
(29 SplitsWhenHit)
(30 (Ray Fire))
(32 (Ray MagicDamage))
(33 (Breath Darkness))
(34 (Throw Spines))
(35 ForceCage)
(36 (Melee Web))
(37 (Radiate Sleep))
(38 (Radiate Stink))
(39 (Radiate Blade))
(otherwise (throw "undefined special_abil"))))

View File

@@ -7,6 +7,7 @@ import data.blades.FloorData;
import flixel.input.keyboard.FlxKey;
import kiss.Prelude;
import kiss.Kiss;
enum Direction {
North;
@@ -59,7 +60,6 @@ enum TerrainSpecialProperty {
QuickFlammable;
}
@:build(kiss.Kiss.build())
class TerrainData {
public function new() {}
@@ -92,6 +92,29 @@ class TerrainData {
private var move_block_w:Int = 0;
private var move_block_s:Int = 0;
private var move_block_e:Int = 0;
static var HILL_DIR_MAP = [
19 => Up(West),
20 => Up(SouthWest),
21 => Up(South),
22 => Up(SouthEast),
23 => Up(East),
24 => Up(NorthEast),
25 => Up(North),
26 => Up(NorthWest),
27 => Down(SouthEast),
28 => Down(NorthEast),
29 => Down(NorthWest),
30 => Down(SouthWest)
];
static var BEAM_DIR_MAP = [
32 => North,
33 => West,
34 => South,
35 => East
];
public function moveBlock(dir:Direction) {
return if (full_move_block == 1) {
true;
@@ -201,6 +224,29 @@ class TerrainData {
return can_look_at == 1;
}
private var special_property:Int = 0;
function specialProperty() {
return Kiss.exp('(case special_property
((when (<= 0 prop 8) prop)
(Floor (FloorSpecialProperty.createEnumIndex prop)))
((when (HILL_DIR_MAP.exists prop) prop)
(Hill (dictGet HILL_DIR_MAP prop)))
(31 (Beam SwapTerrainWhenHit))
((when (BEAM_DIR_MAP.exists prop) prop)
(Beam
(Fire
(dictGet BEAM_DIR_MAP prop))))
(36 (Beam (Mirror BackSlash)))
(37 (Beam (Mirror ForwardSlash)))
(38 (Beam PowerSource))
(39 Sign)
(40 Container)
(41 Table)
(42 ShimmerLightAndDark)
(43 (Waterfall South))
(44 (Waterfall East))
(45 QuickFlammable)
(otherwise (throw "undefined special_property")))');
}
// specialProperty() defined in .kiss file
public var special_strength:Int = 0;

View File

@@ -1,46 +0,0 @@
(var HILL_DIR_MAP
#{[
19 => Up(West),
20 => Up(SouthWest),
21 => Up(South),
22 => Up(SouthEast),
23 => Up(East),
24 => Up(NorthEast),
25 => Up(North),
26 => Up(NorthWest),
27 => Down(SouthEast),
28 => Down(NorthEast),
29 => Down(NorthWest),
30 => Down(SouthWest)
];}#)
(var BEAM_DIR_MAP
#{[
32 => North,
33 => West,
34 => South,
35 => East
];}#)
(method specialProperty []
(case special_property
((when (<= 0 prop 8) prop)
(Floor (FloorSpecialProperty.createEnumIndex prop)))
((when (HILL_DIR_MAP.exists prop) prop)
(Hill (dictGet HILL_DIR_MAP prop)))
(31 (Beam SwapTerrainWhenHit))
((when (BEAM_DIR_MAP.exists prop) prop)
(Beam
(Fire
(dictGet BEAM_DIR_MAP prop))))
(36 (Beam (Mirror BackSlash)))
(37 (Beam (Mirror ForwardSlash)))
(38 (Beam PowerSource))
(39 Sign)
(40 Container)
(41 Table)
(42 ShimmerLightAndDark)
(43 (Waterfall South))
(44 (Waterfall East))
(45 QuickFlammable)
(otherwise (throw "undefined special_property"))))