diff --git a/locals/Character.csv b/locals/Character.csv new file mode 100644 index 0000000..739b695 --- /dev/null +++ b/locals/Character.csv @@ -0,0 +1,3 @@ +id,zh,en,ja +character_necromancer,死灵法师,Necromancer,ネクロマンサー +character_evil_crow,邪恶的乌鸦先生,Evil Mr. Raven,悪のミスター・レイヴン \ No newline at end of file diff --git a/locals/Character.csv.import b/locals/Character.csv.import new file mode 100644 index 0000000..14e1361 --- /dev/null +++ b/locals/Character.csv.import @@ -0,0 +1,17 @@ +[remap] + +importer="csv_translation" +type="Translation" +uid="uid://dwrygxaehoybb" + +[deps] + +files=["res://locals/Character.zh.translation", "res://locals/Character.en.translation", "res://locals/Character.ja.translation"] + +source_file="res://locals/Character.csv" +dest_files=["res://locals/Character.zh.translation", "res://locals/Character.en.translation", "res://locals/Character.ja.translation"] + +[params] + +compress=true +delimiter=0 diff --git a/locals/Log.csv b/locals/Log.csv index 7d4251f..d2d5b1f 100644 --- a/locals/Log.csv +++ b/locals/Log.csv @@ -109,4 +109,8 @@ log_dll_name,已加载{0}。,Loaded {0}.,{0}をロードしました。 log_dll_does_not_register_lifecycle_processor,位于{0}的dll文件,未注册生命周期处理器{1}。,"The DLL file located at {0} does not register the lifecycle processor {1}.",{0}にあるDLLファイルは、ライフサイクルプロセッサ{1}を登録していません。 log_mod_lifecycle_handler_not_implement_interface,位于{0}的dll文件,生命周期处理器未实现IModLifecycleHandler接口。,"The DLL file located at {0}, the lifecycle processor does not implement the IModLifecycleHandler interface.",{0}にあるDLLファイル、ライフサイクルプロセッサはIModLifecycleHandlerインターフェースを実装していません。 log_dll_no_parameterless_constructor,位于{0}的dll文件,没有无参构造函数。,"The DLL file located at {0} does not have a parameterless constructor.",{0}にあるDLLファイルにはパラメータのないコンストラクタがありません。 -log_dll_type_length,位于{0}的dll文件内,共包含{1}个类型。,"The DLL file located at {0} contains a total of {1} types.",{0}にあるDLLファイルには合計{1}個のタイプが含まれています。 \ No newline at end of file +log_dll_type_length,位于{0}的dll文件内,共包含{1}个类型。,"The DLL file located at {0} contains a total of {1} types.",{0}にあるDLLファイルには合計{1}個のタイプが含まれています。 +log_item_pickup_disables_collision_damage,物品捡起禁用碰撞伤害。,Item pickup disables collision damage.,アイテムのピックアップが衝突によるダメージを無効にする +log_item_thrown_restore_collision_damage,物品扔出恢复碰撞伤害。,Item Throw restores collision damage.,アイテム投げは衝突ダメージを回復する。 +log_after_no_longer_in_contact_with_any_tiles,不再与任何瓦片接触后,可以造成伤害。,"After no longer coming into contact with any tiles, it can cause damage",タイルと接触しなくなった後、損傷を引き起こす可能性があります。 +log_contact_with_tiles_disables_damage,与瓦片接触禁用伤害。,"Disabling damage on contact with tiles",タイルとの接触によるダメージの無効化 \ No newline at end of file diff --git a/prefab/entitys/BlackenedAboriginalWarrior.tscn b/prefab/entitys/BlackenedAboriginalWarrior.tscn new file mode 100644 index 0000000..aa806f5 --- /dev/null +++ b/prefab/entitys/BlackenedAboriginalWarrior.tscn @@ -0,0 +1,99 @@ +[gd_scene load_steps=11 format=3 uid="uid://dxx1vqpecig7i"] + +[ext_resource type="Script" path="res://scripts/character/AiCharacter.cs" id="1_ubaid"] +[ext_resource type="Texture2D" uid="uid://c1yxhtiqrfvvp" path="res://sprites/character/BlackenedAboriginalWarrior.png" id="2_pcmq1"] +[ext_resource type="Script" path="res://scripts/damage/DamageNumberNodeSpawn.cs" id="3_kiam3"] +[ext_resource type="PackedScene" uid="uid://sqqfrmikmk5v" path="res://prefab/ui/HealthBar.tscn" id="4_gt388"] +[ext_resource type="Script" path="res://scripts/bubble/BubbleMarker.cs" id="5_y2fh5"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_f8frw"] +size = Vector2(40, 46) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_a3myh"] +size = Vector2(46, 65) + +[sub_resource type="SpriteFrames" id="SpriteFrames_qumby"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": ExtResource("2_pcmq1") +}], +"loop": true, +"name": &"default", +"speed": 5.0 +}] + +[sub_resource type="CircleShape2D" id="CircleShape2D_c61vr"] +radius = 153.0 + +[sub_resource type="CircleShape2D" id="CircleShape2D_fowd5"] +radius = 172.29 + +[node name="BlackenedAboriginalWarrior" type="CharacterBody2D"] +collision_layer = 64 +collision_mask = 38 +script = ExtResource("1_ubaid") +CharacterName = "character_evil_crow" +MaxHp = 50 +CampId = "Mazoku" + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2(2, 10) +shape = SubResource("RectangleShape2D_f8frw") + +[node name="Area2DPickingArea" type="Area2D" parent="."] +collision_layer = 0 +collision_mask = 8 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2DPickingArea"] +position = Vector2(0, 5.5) +shape = SubResource("RectangleShape2D_a3myh") + +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] +sprite_frames = SubResource("SpriteFrames_qumby") + +[node name="ItemMarker2D" type="Marker2D" parent="."] +position = Vector2(15, 20) + +[node name="AttackObstacleDetection" type="RayCast2D" parent="ItemMarker2D"] +collision_mask = 2 + +[node name="DamageNumber" type="Marker2D" parent="."] +position = Vector2(0, -32) +script = ExtResource("3_kiam3") + +[node name="HealthBar" parent="." instance=ExtResource("4_gt388")] +visible = false +offset_left = -46.0 +offset_top = 41.0 +offset_right = 50.0 +offset_bottom = 53.0 + +[node name="WallDetection" type="RayCast2D" parent="."] +position = Vector2(3, -1) +target_position = Vector2(50, 0) +collision_mask = 6 + +[node name="AttackArea2D" type="Area2D" parent="."] +collision_layer = 0 +collision_mask = 68 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="AttackArea2D"] +shape = SubResource("CircleShape2D_c61vr") + +[node name="NavigationAgent2D" type="NavigationAgent2D" parent="."] + +[node name="BubbleMarker" type="Marker2D" parent="."] +position = Vector2(0, -79) +script = ExtResource("5_y2fh5") + +[node name="VisibleOnScreenEnabler2D" type="VisibleOnScreenEnabler2D" parent="."] +position = Vector2(0, 5.5) +scale = Vector2(2.04, 3.05) + +[node name="ScoutArea2D" type="Area2D" parent="."] +collision_layer = 0 +collision_mask = 76 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="ScoutArea2D"] +shape = SubResource("CircleShape2D_fowd5") diff --git a/prefab/entitys/DelivererOfDarkMagic.tscn b/prefab/entitys/DelivererOfDarkMagic.tscn index 4c90b56..86c6515 100644 --- a/prefab/entitys/DelivererOfDarkMagic.tscn +++ b/prefab/entitys/DelivererOfDarkMagic.tscn @@ -34,7 +34,7 @@ radius = 172.29 collision_layer = 64 collision_mask = 38 script = ExtResource("1_ubaid") -CharacterName = "死灵法师" +CharacterName = "character_necromancer" MaxHp = 50 CampId = "Mazoku" LootListId = "test" diff --git a/project.godot b/project.godot index 0387734..ec84ba7 100644 --- a/project.godot +++ b/project.godot @@ -146,7 +146,7 @@ hotbar_previous={ [internationalization] -locale/translations=PackedStringArray("res://locals/DeathInfo.en.translation", "res://locals/DeathInfo.ja.translation", "res://locals/DeathInfo.zh.translation", "res://locals/InputMapping.en.translation", "res://locals/InputMapping.ja.translation", "res://locals/InputMapping.zh.translation", "res://locals/Log.en.translation", "res://locals/Log.ja.translation", "res://locals/Log.zh.translation", "res://locals/Slogan.en.translation", "res://locals/Slogan.ja.translation", "res://locals/Slogan.zh.translation", "res://locals/UI.en.translation", "res://locals/UI.ja.translation", "res://locals/UI.zh.translation", "res://locals/Item.en.translation", "res://locals/Item.ja.translation", "res://locals/Item.zh.translation", "res://locals/Action.en.translation", "res://locals/Action.ja.translation", "res://locals/Action.zh.translation", "res://locals/Misc.en.translation", "res://locals/Misc.ja.translation", "res://locals/Misc.zh.translation") +locale/translations=PackedStringArray("res://locals/DeathInfo.en.translation", "res://locals/DeathInfo.ja.translation", "res://locals/DeathInfo.zh.translation", "res://locals/InputMapping.en.translation", "res://locals/InputMapping.ja.translation", "res://locals/InputMapping.zh.translation", "res://locals/Log.en.translation", "res://locals/Log.ja.translation", "res://locals/Log.zh.translation", "res://locals/Slogan.en.translation", "res://locals/Slogan.ja.translation", "res://locals/Slogan.zh.translation", "res://locals/UI.en.translation", "res://locals/UI.ja.translation", "res://locals/UI.zh.translation", "res://locals/Item.en.translation", "res://locals/Item.ja.translation", "res://locals/Item.zh.translation", "res://locals/Action.en.translation", "res://locals/Action.ja.translation", "res://locals/Action.zh.translation", "res://locals/Misc.en.translation", "res://locals/Misc.ja.translation", "res://locals/Misc.zh.translation", "res://locals/Character.en.translation", "res://locals/Character.ja.translation", "res://locals/Character.zh.translation") [layer_names] diff --git a/scripts/character/CharacterTemplate.cs b/scripts/character/CharacterTemplate.cs index d6d8642..ed1f4e4 100644 --- a/scripts/character/CharacterTemplate.cs +++ b/scripts/character/CharacterTemplate.cs @@ -73,10 +73,9 @@ public partial class CharacterTemplate : CharacterBody2D //物品被扔出后多长时间恢复与地面和平台的碰撞(单位:秒) private readonly double _itemCollisionRecoveryTime = 0.045f; - public string? ReadOnlyCharacterName => CharacterName; + public string? ReadOnlyCharacterName => TranslationServerUtils.Translate(CharacterName); - [Export] - public string? CharacterName; + [Export] public string? CharacterName; protected IItemContainer? ProtectedItemContainer; @@ -157,18 +156,15 @@ public partial class CharacterTemplate : CharacterBody2D //The initial health of the character after creation //角色创建后的初始血量 - [Export] - public int InitialHp; + [Export] public int InitialHp; - [Export] - public int MaxHp; + [Export] public int MaxHp; /// /// The camp ID of the role /// 角色的阵营ID /// - [Export] - public string? CampId; + [Export] public string? CampId; private DamageNumberNodeSpawn? _damageNumber; @@ -248,8 +244,10 @@ public partial class CharacterTemplate : CharacterBody2D { continue; } + weaponTemplates.Add(weaponTemplate); } + return weaponTemplates.ToArray(); } @@ -385,6 +383,7 @@ public partial class CharacterTemplate : CharacterBody2D pickAbleTemplate.Picked = true; pickAbleTemplate.SetCollisionMaskValue(Config.LayerNumber.Platform, false); pickAbleTemplate.SetCollisionMaskValue(Config.LayerNumber.Ground, false); + LogCat.Log("item_pickup_disables_collision_damage", LogCat.LogLabel.ContactInjury); pickAbleTemplate.EnableContactInjury = false; pickAbleTemplate.Sleeping = true; } @@ -519,6 +518,7 @@ public partial class CharacterTemplate : CharacterBody2D ThrowAllItemOnDie(); return true; } + UpDataHealthBar(); return false; } @@ -751,6 +751,7 @@ public partial class CharacterTemplate : CharacterBody2D //We cannot immediately resume the physical collision when the weapon is discharged, which will cause the weapon to collide with the ground and platform earlier, preventing the weapon from flying. //仍出武器时,我们不能立即恢复物理碰撞,立即恢复会导致武器更早的与地面和平台碰撞,阻止武器的飞行。 pickAbleTemplate.EnableContactInjury = true; + LogCat.Log("item_thrown_restore_collision_damage", LogCat.LogLabel.ContactInjury); pickAbleTemplate.SetCollisionMaskValue(Config.LayerNumber.Ground, true); pickAbleTemplate.SetCollisionMaskValue(Config.LayerNumber.Platform, true); timer.QueueFree(); diff --git a/scripts/debug/LogCat.cs b/scripts/debug/LogCat.cs index 1fe6e02..bc5b2db 100644 --- a/scripts/debug/LogCat.cs +++ b/scripts/debug/LogCat.cs @@ -70,6 +70,18 @@ public static class LogCat /// 模组加载器 /// public const string ModLoader = "ModLoader"; + + /// + /// PickAble Template + /// 可拾取物模板 + /// + public const string PickAbleTemplate = "PickAbleTemplate"; + + /// + /// ContactInjury + /// 物品碰撞伤害 + /// + public const string ContactInjury = "ContactInjury"; } diff --git a/scripts/pickable/PickAbleTemplate.cs b/scripts/pickable/PickAbleTemplate.cs index ea3852b..5e0604c 100644 --- a/scripts/pickable/PickAbleTemplate.cs +++ b/scripts/pickable/PickAbleTemplate.cs @@ -106,6 +106,7 @@ public partial class PickAbleTemplate : RigidBody2D, IItem //No longer in contact with any shingles can cause injury //不再与任何瓦片接触后,可以造成伤害 EnableContactInjury = true; + LogCat.Log("after_no_longer_in_contact_with_any_tiles", LogCat.LogLabel.ContactInjury); SetCollisionMaskValue(Config.LayerNumber.Player, false); } } @@ -127,6 +128,7 @@ public partial class PickAbleTemplate : RigidBody2D, IItem { _tileMapNumber++; EnableContactInjury = false; + LogCat.Log("contact_with_tiles_disables_damage", LogCat.LogLabel.ContactInjury); //Items can be pushed by the player when they are on the ground //当物品在地面上时,可被玩家推动 SetCollisionMaskValue(Config.LayerNumber.Player, true); @@ -135,20 +137,20 @@ public partial class PickAbleTemplate : RigidBody2D, IItem { if (!EnableContactInjury) { - LogCat.LogWarning("contact_damage_disabled_during_collision"); + LogCat.LogWarning("contact_damage_disabled_during_collision", LogCat.LogLabel.ContactInjury); return; } if (Owner == null) { - LogCat.LogWarning("item_has_no_owner"); + LogCat.LogWarning("item_has_no_owner", LogCat.LogLabel.PickAbleTemplate); return; } if (Owner is not CharacterTemplate ownerCharacterTemplate) { - LogCat.LogWarning("owner_of_the_item_is_not_character"); + LogCat.LogWarning("owner_of_the_item_is_not_character", LogCat.LogLabel.PickAbleTemplate); return; } @@ -158,7 +160,7 @@ public partial class PickAbleTemplate : RigidBody2D, IItem CampManager.GetCamp(characterTemplate.CampId)); if (!canCauseHarm) { - LogCat.Log("no_damage_between_camps"); + LogCat.Log("no_damage_between_camps", LogCat.LogLabel.PickAbleTemplate); return; } diff --git a/scripts/weapon/ProjectileWeapon.cs b/scripts/weapon/ProjectileWeapon.cs index ef2365c..f022114 100644 --- a/scripts/weapon/ProjectileWeapon.cs +++ b/scripts/weapon/ProjectileWeapon.cs @@ -69,7 +69,7 @@ public partial class ProjectileWeapon : WeaponTemplate var nodeSpawnOnKillCharacterDecorator = new NodeSpawnOnKillCharacterDecorator { DefaultParentNode = this, - PackedScenePath = "res://prefab/entitys/DelivererOfDarkMagic.tscn" + PackedScenePath = "res://prefab/entitys/BlackenedAboriginalWarrior.tscn" }; projectile.AddProjectileDecorator(nodeSpawnOnKillCharacterDecorator); } diff --git a/sprites/character/BlackenedAboriginalWarrior.png b/sprites/character/BlackenedAboriginalWarrior.png new file mode 100644 index 0000000..be63581 Binary files /dev/null and b/sprites/character/BlackenedAboriginalWarrior.png differ diff --git a/sprites/character/BlackenedAboriginalWarrior.png.import b/sprites/character/BlackenedAboriginalWarrior.png.import new file mode 100644 index 0000000..238bfda --- /dev/null +++ b/sprites/character/BlackenedAboriginalWarrior.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c1yxhtiqrfvvp" +path="res://.godot/imported/BlackenedAboriginalWarrior.png-483f0928238bc97273aa2fd838825f33.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://sprites/character/BlackenedAboriginalWarrior.png" +dest_files=["res://.godot/imported/BlackenedAboriginalWarrior.png-483f0928238bc97273aa2fd838825f33.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1