From a29660eb3754c482a8792614838c63204904a725 Mon Sep 17 00:00:00 2001 From: xescugc Date: Wed, 5 Jun 2024 13:54:27 +0200 Subject: [PATCH] unit: Added the 'Blend Master' with 'Camouflage' --- assets/assets.go | 8 ++++---- assets/units.json | 5 +++-- store/lines.go | 29 +++++++++++++++++++++++------ unit/ability/ability.go | 1 + unit/ability/ability_string.go | 12 ++++++++---- unit/type.go | 2 +- unit/type_string.go | 12 ++++++------ unit/unit.go | 4 ++-- 8 files changed, 48 insertions(+), 25 deletions(-) diff --git a/assets/assets.go b/assets/assets.go index 8ad9a66..ac7df32 100644 --- a/assets/assets.go +++ b/assets/assets.go @@ -55,11 +55,11 @@ var ButterflyWalk_png []byte //go:embed ninja_adventure_asset_pack/Actor/Monsters/Butterfly/Faceset.png var ButterflyFaceset_png []byte -//go:embed ninja_adventure_asset_pack/Actor/Characters/NinjaMasked/SeparateAnim/Walk.png -var NinjaMaskedWalk_png []byte +//go:embed ninja_adventure_asset_pack/Actor/Characters/CamouflageRed/SeparateAnim/Walk.png +var BlendMasterWalk_png []byte -//go:embed ninja_adventure_asset_pack/Actor/Characters/NinjaMasked/Faceset.png -var NinjaMaskedFaceset_png []byte +//go:embed ninja_adventure_asset_pack/Actor/Characters/CamouflageRed/Faceset.png +var BlendMasterFaceset_png []byte //go:embed ninja_adventure_asset_pack/Actor/Characters/RobotGrey/SeparateAnim/Walk.png var RobotWalk_png []byte diff --git a/assets/units.json b/assets/units.json index 25b8f1c..6f1a42a 100644 --- a/assets/units.json +++ b/assets/units.json @@ -51,12 +51,13 @@ "environment":"aerial", "movement_speed": 30 }, - "ninja_masked":{ + "blend_master":{ "health": 10, "gold": 15, "keybind":"8", "environment":"terrestrial", - "movement_speed": 50 + "movement_speed": 40, + "abilities":["camouflage"] }, "robot":{ "health": 5, diff --git a/store/lines.go b/store/lines.go index 53afb6c..b7568ec 100644 --- a/store/lines.go +++ b/store/lines.go @@ -934,20 +934,37 @@ func (ls *Lines) moveLineUnitsTo(lstate LinesState, lid int, t time.Time) { var ( minDist float64 = 0 minDistUnit *Unit + + // The potential Camouflage units + minDistCam float64 = 0 + minDistCamUnit *Unit ) for _, u := range l.Units { if !tw.CanTarget(unit.Units[u.Type].Environment) || u.HasBuff(buff.Burrowoed) || u.HasBuff(buff.Resurrecting) { continue } d := tw.PDistance(u.Object) - if minDist == 0 { - minDist = d - } - if d <= tower.Towers[tw.Type].Range && d <= minDist { - minDist = d - minDistUnit = u + if u.HasAbility(ability.Camouflage) { + if minDistCam == 0 { + minDistCam = d + } + if d <= tower.Towers[tw.Type].Range && d <= minDistCam { + minDistCam = d + minDistCamUnit = u + } + } else { + if minDist == 0 { + minDist = d + } + if d <= tower.Towers[tw.Type].Range && d <= minDist { + minDist = d + minDistUnit = u + } } } + if minDistUnit == nil && minDistCamUnit != nil { + minDistUnit = minDistCamUnit + } if minDistUnit != nil { // Tower Attack if minDistUnit.Shield != 0 { diff --git a/unit/ability/ability.go b/unit/ability/ability.go index 18a7739..fc965bd 100644 --- a/unit/ability/ability.go +++ b/unit/ability/ability.go @@ -9,4 +9,5 @@ const ( Burrow Resurrection Hybrid + Camouflage ) diff --git a/unit/ability/ability_string.go b/unit/ability/ability_string.go index 2d24f09..52b0d26 100644 --- a/unit/ability/ability_string.go +++ b/unit/ability/ability_string.go @@ -8,11 +8,11 @@ import ( "strings" ) -const _AbilityName = "splitburrowresurrectionhybrid" +const _AbilityName = "splitburrowresurrectionhybridcamouflage" -var _AbilityIndex = [...]uint8{0, 5, 11, 23, 29} +var _AbilityIndex = [...]uint8{0, 5, 11, 23, 29, 39} -const _AbilityLowerName = "splitburrowresurrectionhybrid" +const _AbilityLowerName = "splitburrowresurrectionhybridcamouflage" func (i Ability) String() string { if i < 0 || i >= Ability(len(_AbilityIndex)-1) { @@ -29,9 +29,10 @@ func _AbilityNoOp() { _ = x[Burrow-(1)] _ = x[Resurrection-(2)] _ = x[Hybrid-(3)] + _ = x[Camouflage-(4)] } -var _AbilityValues = []Ability{Split, Burrow, Resurrection, Hybrid} +var _AbilityValues = []Ability{Split, Burrow, Resurrection, Hybrid, Camouflage} var _AbilityNameToValueMap = map[string]Ability{ _AbilityName[0:5]: Split, @@ -42,6 +43,8 @@ var _AbilityNameToValueMap = map[string]Ability{ _AbilityLowerName[11:23]: Resurrection, _AbilityName[23:29]: Hybrid, _AbilityLowerName[23:29]: Hybrid, + _AbilityName[29:39]: Camouflage, + _AbilityLowerName[29:39]: Camouflage, } var _AbilityNames = []string{ @@ -49,6 +52,7 @@ var _AbilityNames = []string{ _AbilityName[5:11], _AbilityName[11:23], _AbilityName[23:29], + _AbilityName[29:39], } // AbilityString retrieves an enum value from the enum constants string name. diff --git a/unit/type.go b/unit/type.go index 249f05d..4634681 100644 --- a/unit/type.go +++ b/unit/type.go @@ -12,7 +12,7 @@ const ( Mole SkeletonDemon Butterfly - NinjaMasked + BlendMaster Robot MonkeyBoxer ) diff --git a/unit/type_string.go b/unit/type_string.go index 014b67b..c5c2373 100644 --- a/unit/type_string.go +++ b/unit/type_string.go @@ -7,11 +7,11 @@ import ( "strings" ) -const _TypeName = "ninjastatuehunterslimemoleskeleton_demonbutterflyninja_maskedrobotmonkey_boxer" +const _TypeName = "ninjastatuehunterslimemoleskeleton_demonbutterflyblend_masterrobotmonkey_boxer" var _TypeIndex = [...]uint8{0, 5, 11, 17, 22, 26, 40, 49, 61, 66, 78} -const _TypeLowerName = "ninjastatuehunterslimemoleskeleton_demonbutterflyninja_maskedrobotmonkey_boxer" +const _TypeLowerName = "ninjastatuehunterslimemoleskeleton_demonbutterflyblend_masterrobotmonkey_boxer" func (i Type) String() string { if i < 0 || i >= Type(len(_TypeIndex)-1) { @@ -31,12 +31,12 @@ func _TypeNoOp() { _ = x[Mole-(4)] _ = x[SkeletonDemon-(5)] _ = x[Butterfly-(6)] - _ = x[NinjaMasked-(7)] + _ = x[BlendMaster-(7)] _ = x[Robot-(8)] _ = x[MonkeyBoxer-(9)] } -var _TypeValues = []Type{Ninja, Statue, Hunter, Slime, Mole, SkeletonDemon, Butterfly, NinjaMasked, Robot, MonkeyBoxer} +var _TypeValues = []Type{Ninja, Statue, Hunter, Slime, Mole, SkeletonDemon, Butterfly, BlendMaster, Robot, MonkeyBoxer} var _TypeNameToValueMap = map[string]Type{ _TypeName[0:5]: Ninja, @@ -53,8 +53,8 @@ var _TypeNameToValueMap = map[string]Type{ _TypeLowerName[26:40]: SkeletonDemon, _TypeName[40:49]: Butterfly, _TypeLowerName[40:49]: Butterfly, - _TypeName[49:61]: NinjaMasked, - _TypeLowerName[49:61]: NinjaMasked, + _TypeName[49:61]: BlendMaster, + _TypeLowerName[49:61]: BlendMaster, _TypeName[61:66]: Robot, _TypeLowerName[61:66]: Robot, _TypeName[66:78]: MonkeyBoxer, diff --git a/unit/unit.go b/unit/unit.go index 4746adb..27a567b 100644 --- a/unit/unit.go +++ b/unit/unit.go @@ -56,7 +56,7 @@ var ( Mole: assets.MoleWalk_png, SkeletonDemon: assets.SkeletonDemonWalk_png, Butterfly: assets.ButterflyWalk_png, - NinjaMasked: assets.NinjaMaskedWalk_png, + BlendMaster: assets.BlendMasterWalk_png, Robot: assets.RobotWalk_png, MonkeyBoxer: assets.MonkeyBoxerWalk_png, } @@ -69,7 +69,7 @@ var ( Mole: assets.MoleFaceset_png, SkeletonDemon: assets.SkeletonDemonFaceset_png, Butterfly: assets.ButterflyFaceset_png, - NinjaMasked: assets.NinjaMaskedFaceset_png, + BlendMaster: assets.BlendMasterFaceset_png, Robot: assets.RobotFaceset_png, MonkeyBoxer: assets.MonkeyBoxerFaceset_png, }