mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-27 22:41:56 +08:00
feat(召唤系统): 实现彩虹旗召唤物及相关功能
添加SummonBase作为召唤物基类,实现LGBTFlag召唤物 修改LGBTWeapon从发射子弹改为召唤彩虹旗 在ComponentManager中添加召唤物管理功能 更新公鸡角色预设使用彩虹旗武器
This commit is contained in:
@@ -1,19 +1,15 @@
|
||||
[gd_scene load_steps=18 format=3 uid="uid://bm7ymrri6pykb"]
|
||||
[gd_scene load_steps=14 format=3 uid="uid://bm7ymrri6pykb"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cvogxi7mktumf" path="res://components/Abstracts/EntityBase.tscn" id="1_e5pl8"]
|
||||
[ext_resource type="Script" uid="uid://cthtupc6dtbav" path="res://scripts/Contents/Characters/Rooster.gd" id="2_oqdqd"]
|
||||
[ext_resource type="Texture2D" uid="uid://fn8qx72clh38" path="res://resources/characters/cock/rooster-a.svg" id="2_q0j6j"]
|
||||
[ext_resource type="AudioStream" uid="uid://dclinyhu256xi" path="res://resources/sounds/effect/Low Whoosh.mp3" id="3_4syso"]
|
||||
[ext_resource type="Texture2D" uid="uid://ci2ik43ce82uy" path="res://resources/characters/cock/rooster-b.svg" id="3_b0fgx"]
|
||||
[ext_resource type="PackedScene" uid="uid://c0n3igy4hucrg" path="res://components/Weapons/PurpleCrystal.tscn" id="3_hsdc3"]
|
||||
[ext_resource type="PackedScene" uid="uid://wl8u5m52708w" path="res://components/Weapons/LGBT.tscn" id="3_joj4g"]
|
||||
[ext_resource type="AudioStream" uid="uid://cdrevrq7n6yqa" path="res://resources/sounds/effect/Boing.mp3" id="4_66s6c"]
|
||||
[ext_resource type="AudioStream" uid="uid://benyec5bqni0b" path="res://resources/sounds/effect/Chomp.wav" id="4_k0yme"]
|
||||
[ext_resource type="PackedScene" uid="uid://bb1uh8k7gkhr7" path="res://components/Weapons/VectorStar.tscn" id="4_omfco"]
|
||||
[ext_resource type="PackedScene" uid="uid://cxabqjo7skxev" path="res://components/Weapons/BigLaser.tscn" id="5_jpf7h"]
|
||||
[ext_resource type="AudioStream" uid="uid://dmxh3bpk8vyy5" path="res://resources/sounds/effect/Coin.mp3" id="5_xnbhq"]
|
||||
[ext_resource type="PackedScene" uid="uid://b2qhes4apaxsj" path="res://components/Weapons/NuclearBomb.tscn" id="6_ldigc"]
|
||||
[ext_resource type="AudioStream" uid="uid://4wuuf1osk0yv" path="res://resources/sounds/effect/Low Boing.wav" id="6_m5px1"]
|
||||
[ext_resource type="PackedScene" uid="uid://frwt0fgrpskb" path="res://components/Weapons/Meowmere.tscn" id="7_u4w6u"]
|
||||
[ext_resource type="AudioStream" uid="uid://b10u6iir6uvqn" path="res://resources/sounds/effect/BigLaser.wav" id="8_7dhim"]
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_4v2ol"]
|
||||
@@ -48,17 +44,7 @@ displayName = "公鸡"
|
||||
[node name="weaponStore" parent="." index="0"]
|
||||
process_mode = 4
|
||||
|
||||
[node name="PurpleCrystal" parent="weaponStore" index="0" instance=ExtResource("3_hsdc3")]
|
||||
debugRebuild = false
|
||||
|
||||
[node name="VectorStar" parent="weaponStore" index="1" instance=ExtResource("4_omfco")]
|
||||
|
||||
[node name="BigLaser" parent="weaponStore" index="2" instance=ExtResource("5_jpf7h")]
|
||||
|
||||
[node name="NuclearBomb" parent="weaponStore" index="3" instance=ExtResource("6_ldigc")]
|
||||
debugRebuild = false
|
||||
|
||||
[node name="Meowmere" parent="weaponStore" index="4" instance=ExtResource("7_u4w6u")]
|
||||
[node name="LGBT" parent="weaponStore" index="0" instance=ExtResource("3_joj4g")]
|
||||
|
||||
[node name="sprint" parent="sounds" index="0"]
|
||||
stream = ExtResource("4_66s6c")
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://b83iw0a062qp"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cvogxi7mktumf" path="res://components/Abstracts/EntityBase.tscn" id="1_fktqv"]
|
||||
[ext_resource type="Script" uid="uid://11fi3jjdm810" path="res://scripts/Contents/Summons/LGBTFlag.gd" id="2_6d456"]
|
||||
|
||||
[node name="LGBTFlag" instance=ExtResource("1_fktqv")]
|
||||
script = ExtResource("2_6d456")
|
||||
attraction = 0.5
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://wl8u5m52708w"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ckq2cq6m23hq3" path="res://components/Abstracts/WeaponCardBase.tscn" id="1_jwtmd"]
|
||||
[ext_resource type="Script" path="res://scripts/Contents/Weapons/LGBTWeapon.gd" id="2_0tyah"]
|
||||
[ext_resource type="Script" uid="uid://cj72d1ckmojex" path="res://scripts/Contents/Weapons/LGBTWeapon.gd" id="2_0tyah"]
|
||||
[ext_resource type="Texture2D" uid="uid://cwfyi61xkt4bt" path="res://resources/weapons/lgbt.jpeg" id="2_ou6jo"]
|
||||
[ext_resource type="AudioStream" uid="uid://bgo8p1l77xrbe" path="res://resources/sounds/effect/Magic Spell.wav" id="4_c5xse"]
|
||||
|
||||
@@ -29,7 +29,7 @@ storeType = {
|
||||
}
|
||||
descriptionTemplate = "每$angle发射1/$count条以$power效率追踪$trace秒的[b]七彩光标[/b],每条造成$atk点伤害。"
|
||||
needEnergy = 25.0
|
||||
cooldown = 1000.0
|
||||
cooldown = 0.1
|
||||
|
||||
[node name="attack" parent="sounds" index="0"]
|
||||
stream = ExtResource("4_c5xse")
|
||||
@@ -37,7 +37,14 @@ stream = ExtResource("4_c5xse")
|
||||
[node name="avatar" parent="container/info" index="0"]
|
||||
texture = ExtResource("2_ou6jo")
|
||||
|
||||
[node name="energy" parent="container/info/infos/energyInfo" index="1"]
|
||||
text = "25.0"
|
||||
|
||||
[node name="beachball" parent="container/info/infos" index="1"]
|
||||
count = 200
|
||||
|
||||
[node name="soul" parent="container/info/infos" index="2"]
|
||||
count = 1
|
||||
|
||||
[node name="name" parent="container/info" index="2"]
|
||||
displayName = "彩虹旗"
|
||||
@@ -46,5 +53,5 @@ typeTopic = 3
|
||||
|
||||
[node name="description" parent="container" index="2"]
|
||||
size_flags_vertical = 3
|
||||
text = "[center]每[color=cyan]30.0°[/color]→[color=yellow]28.6°[/color]发射1/[color=cyan]7[/color]→[color=yellow]8[/color]条以[color=cyan]25%[/color]→[color=yellow]30%[/color]效率追踪[color=cyan]2.00[/color]→[color=yellow]2.25[/color]秒的[b]七彩光标[/b],每条造成[color=cyan]20[/color]→[color=yellow]25[/color]点伤害。[/center]"
|
||||
text = "[center]每[color=cyan]30.0°[/color]发射1/[color=cyan]7[/color]条以[color=cyan]25%[/color]效率追踪[color=cyan]2.00[/color]秒的[b]七彩光标[/b],每条造成[color=cyan]20[/color]点伤害。[/center]"
|
||||
autowrap_mode = 2
|
||||
|
||||
@@ -3,7 +3,7 @@ class_name LGBTBullet
|
||||
|
||||
var tracer: EntityBase = null
|
||||
var maxTraceTime: float = 0
|
||||
var tracePower: float
|
||||
var tracePower: float = 0
|
||||
|
||||
func register():
|
||||
speed = 1
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
extends SummonBase
|
||||
|
||||
var atk: float = 0
|
||||
var maxTraceTime: float = 0
|
||||
var tracePower: float = 0
|
||||
|
||||
func register():
|
||||
fields[FieldStore.Entity.MAX_HEALTH] = 100
|
||||
attackCooldownMap[0] = 500
|
||||
func ai():
|
||||
tryAttack(0)
|
||||
func attack(type):
|
||||
if type == 0:
|
||||
for bullet in BulletBase.generate(
|
||||
ComponentManager.getBullet("LGBTBullet"),
|
||||
self,
|
||||
findWeaponAnchor("normal"),
|
||||
position.angle_to_point(EntityTool.findClosetEntity(position, get_tree(), false, true).position)
|
||||
):
|
||||
bullet.damage = atk
|
||||
bullet.maxTraceTime = maxTraceTime
|
||||
bullet.tracePower = tracePower
|
||||
@@ -0,0 +1 @@
|
||||
uid://11fi3jjdm810
|
||||
@@ -4,20 +4,12 @@ class_name LGBTWeapon
|
||||
|
||||
func update(to: int, origin: Dictionary, _entity: EntityBase):
|
||||
origin["atk"] += 5 * to * soulLevel
|
||||
origin["count"] += to * soulLevel
|
||||
origin["power"] += 0.05 * to * soulLevel
|
||||
origin["trace"] += 0.25 * to * soulLevel
|
||||
origin["angle"] /= 1 + 0.05 * to * soulLevel
|
||||
return origin
|
||||
func attack(entity: EntityBase):
|
||||
var weaponPos = entity.findWeaponAnchor("normal")
|
||||
var facingAngle = (get_global_mouse_position() - weaponPos).angle()
|
||||
var startAngle = facingAngle - deg_to_rad(readStore("angle") * (readStore("count") / 2))
|
||||
for i in range(int(readStore("count"))):
|
||||
for j in BulletBase.generate(ComponentManager.getBullet("LGBTBullet"), entity, weaponPos, startAngle + deg_to_rad(readStore("angle") * i)):
|
||||
var bullet: LGBTBullet = j
|
||||
bullet.damage = readStore("atk")
|
||||
bullet.tracer = EntityTool.findClosetEntity(get_global_mouse_position(), get_tree(), !entity.isPlayer(), entity.isPlayer())
|
||||
bullet.maxTraceTime = readStore("trace") * 1000
|
||||
bullet.tracePower = readStore("power")
|
||||
var summon = entity.summon(ComponentManager.getSummon("LGBTFlag"))
|
||||
summon.atk = readStore("atk")
|
||||
summon.maxTraceTime = readStore("trace") * 1000
|
||||
summon.tracePower = readStore("power")
|
||||
return true
|
||||
|
||||
@@ -374,7 +374,19 @@ func useItem(items: Dictionary):
|
||||
func getItem(items: Dictionary):
|
||||
for item in items:
|
||||
inventory[item] = clamp(inventory[item] + items[item], 0, inventoryMax[item])
|
||||
func summon(who: PackedScene, syncFields: bool = true, lockValue: bool = true) -> SummonBase:
|
||||
var instance: SummonBase = who.instantiate()
|
||||
instance.myMaster = self
|
||||
if isPlayer(): instance.add_to_group("players")
|
||||
if syncFields:
|
||||
if lockValue:
|
||||
instance.fields = fields.duplicate()
|
||||
else:
|
||||
instance.fields = fields
|
||||
get_parent().add_child(instance)
|
||||
return instance
|
||||
|
||||
# 关于追踪
|
||||
func getTrackingAnchor() -> Vector2:
|
||||
return hurtbox.get_node("hitbox").global_position
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
extends EntityBase
|
||||
class_name SummonBase
|
||||
|
||||
@export var attraction: float = 0.0
|
||||
|
||||
var myMaster: EntityBase = null
|
||||
|
||||
func _ready():
|
||||
for entity in get_tree().get_nodes_in_group("mobs"):
|
||||
var ent = entity as EntityBase
|
||||
if MathTool.rate(attraction):
|
||||
ent.currentFocusedBoss = self
|
||||
if is_instance_valid(myMaster):
|
||||
myMaster.died.connect(tryDie)
|
||||
@@ -0,0 +1 @@
|
||||
uid://bnsl0c5xltsic
|
||||
@@ -4,6 +4,7 @@ class_name ComponentManager
|
||||
|
||||
static var bullets = {}
|
||||
static var characters = {}
|
||||
static var summons = {}
|
||||
static var effects = {}
|
||||
static var feeds = []
|
||||
static var uiComponents = {}
|
||||
@@ -16,6 +17,8 @@ static func init():
|
||||
bullets[DirTool.getBasenameWithoutExtension(i)] = load(i)
|
||||
for i in DirTool.listdir("res://components/Characters"):
|
||||
characters[DirTool.getBasenameWithoutExtension(i)] = load(i)
|
||||
for i in DirTool.listdir("res://components/Summons"):
|
||||
summons[DirTool.getBasenameWithoutExtension(i)] = load(i)
|
||||
for i in DirTool.listdir("res://components/Effects"):
|
||||
effects[DirTool.getBasenameWithoutExtension(i)] = load(i)
|
||||
for i in DirTool.listdir("res://components/Feeds"):
|
||||
@@ -32,6 +35,8 @@ static func getBullet(t: String) -> PackedScene:
|
||||
return MathTool.priority(bullets.get(t, false), load("res://components/Bullets/%s.tscn" % t))
|
||||
static func getCharacter(t: String) -> PackedScene:
|
||||
return MathTool.priority(characters.get(t, false), load("res://components/Characters/%s.tscn" % t))
|
||||
static func getSummon(t: String) -> PackedScene:
|
||||
return MathTool.priority(summons.get(t, false), load("res://components/Summons/%s.tscn" % t))
|
||||
static func getEffect(t: String) -> PackedScene:
|
||||
return MathTool.priority(effects.get(t, false), load("res://components/Effects/%s.tscn" % t))
|
||||
static func getFeed(i: int) -> PackedScene:
|
||||
|
||||
Reference in New Issue
Block a user