master
parent
c3ae100197
commit
b9c1dbb5b0
@ -0,0 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CMSGame
|
||||
{
|
||||
public class GameSave
|
||||
{
|
||||
public List<Character> Characters;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CMSGame
|
||||
{
|
||||
public static class BattleGoals
|
||||
{
|
||||
public static readonly BattleGoal Escape = new()
|
||||
{
|
||||
Name = "保命要紧",
|
||||
BasePriority = -50
|
||||
};
|
||||
|
||||
public static readonly BattleGoal SelfRegulatory = new()
|
||||
{
|
||||
Name = "自律行动",
|
||||
BasePriority = 0
|
||||
};
|
||||
|
||||
public static readonly BattleGoal FollowOrder = new()
|
||||
{
|
||||
Name = "服从指令",
|
||||
BasePriority = 50
|
||||
};
|
||||
|
||||
public static List<BattleGoal> AllGoals()
|
||||
{
|
||||
return new() {
|
||||
Escape,
|
||||
SelfRegulatory,
|
||||
FollowOrder
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
namespace CMSGame
|
||||
{
|
||||
public class Characters
|
||||
public static class Characters
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CMSGame
|
||||
{
|
||||
public abstract class Action
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public ActionTargetTypes TargetType;
|
||||
|
||||
public List<IActionTarget> Targets;
|
||||
|
||||
public IActionTarget Target => Targets.Count > 0 ? Targets[0] : null;
|
||||
}
|
||||
|
||||
public enum ActionTargetTypes
|
||||
{
|
||||
None,
|
||||
Single,
|
||||
Multiple
|
||||
}
|
||||
|
||||
public interface IActionTarget
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CMSGame
|
||||
{
|
||||
public class Battle
|
||||
{
|
||||
public List<BattleParty> Parties;
|
||||
|
||||
public BattleParty Attacker;
|
||||
|
||||
public BattleParty Defender;
|
||||
|
||||
public BattleParty PlayerParty;
|
||||
|
||||
public Battle()
|
||||
{
|
||||
// load characters of the attacker and defender;
|
||||
}
|
||||
|
||||
public void Begin()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -1,58 +1,22 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CMSGame
|
||||
{
|
||||
public partial class BattleCharacter : CharacterBody3D
|
||||
public class BattleCharacter
|
||||
{
|
||||
[Signal]
|
||||
public delegate void MousePressedEventHandler(Vector3 position);
|
||||
|
||||
[Export]
|
||||
public Texture SpriteTexture;
|
||||
|
||||
public BattleFieldPosition BattleFieldPosition;
|
||||
public List<BattleGoal> Goals;
|
||||
|
||||
public Character Character;
|
||||
|
||||
public Sprite3D Sprite3D;
|
||||
|
||||
public Label3D StatusLabel;
|
||||
|
||||
public int ActionPoint;
|
||||
|
||||
public double ActionPointGathering;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
this.GetUniqueNode(ref Sprite3D, nameof(Sprite3D));
|
||||
this.GetUniqueNode(ref StatusLabel, nameof(StatusLabel));
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
UpdateStatus(delta);
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
public void UpdateStatus(double delta)
|
||||
{
|
||||
ActionPointGathering += delta;
|
||||
ActionPoint += (int)ActionPointGathering / 10;
|
||||
ActionPointGathering %= 10;
|
||||
}
|
||||
|
||||
public void UpdateUI()
|
||||
public BattleCharacter(Character character)
|
||||
{
|
||||
StatusLabel.Text = $"HP {120}\nAP {ActionPoint}";
|
||||
Character = character;
|
||||
EstablishGoals();
|
||||
}
|
||||
|
||||
public override void _InputEvent(Camera3D camera, InputEvent @event, Vector3 position, Vector3 normal, int shapeIdx)
|
||||
private void EstablishGoals()
|
||||
{
|
||||
if (@event is InputEventMouseButton mouseButtonEvent)
|
||||
{
|
||||
if (mouseButtonEvent.Pressed)
|
||||
{
|
||||
EmitSignal(SignalName.MousePressed, position);
|
||||
}
|
||||
}
|
||||
Goals = BattleGoals.AllGoals();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CMSGame
|
||||
{
|
||||
public class BattleParty
|
||||
{
|
||||
public bool IsAttacker;
|
||||
|
||||
public bool IsDefender;
|
||||
|
||||
public bool IsPlayerParty;
|
||||
|
||||
public List<BattleCharacter> Characters;
|
||||
}
|
||||
}
|
@ -1,15 +1,15 @@
|
||||
namespace CMSGame
|
||||
{
|
||||
public partial class Character : Node
|
||||
public class Character
|
||||
{
|
||||
public int HealthPoint;
|
||||
public string FamilyName;
|
||||
|
||||
public string GivenName;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
}
|
||||
public string Name => FamilyName + GivenName;
|
||||
|
||||
public int HealthPoint;
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
}
|
||||
public int MaxHealthPoint;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
namespace CMSGame
|
||||
{
|
||||
public abstract class Effect
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public string Description;
|
||||
|
||||
public abstract void Perform(Character character);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
namespace CMSGame
|
||||
{
|
||||
public class Goal
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public bool IsValid;
|
||||
|
||||
public int BasePriority;
|
||||
}
|
||||
|
||||
public class BattleGoal : Goal
|
||||
{
|
||||
}
|
||||
|
||||
public class GoalModifier
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CMSGame
|
||||
{
|
||||
public abstract class Skill
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public List<Effect> Effects;
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
namespace CMSGame
|
||||
{
|
||||
public partial class BattleCharacterNode : CharacterBody3D
|
||||
{
|
||||
[Signal]
|
||||
public delegate void MousePressedEventHandler(Vector3 position);
|
||||
|
||||
[Export]
|
||||
public Texture SpriteTexture;
|
||||
|
||||
public BattleFieldPosition BattleFieldPosition;
|
||||
|
||||
public Character Character;
|
||||
|
||||
public Sprite3D Sprite3D;
|
||||
|
||||
public Label3D StatusLabel;
|
||||
|
||||
public int ActionPoint;
|
||||
|
||||
public double ActionPointGathering;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
this.GetUniqueNode(ref Sprite3D, nameof(Sprite3D));
|
||||
this.GetUniqueNode(ref StatusLabel, nameof(StatusLabel));
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
UpdateStatus(delta);
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
public void UpdateStatus(double delta)
|
||||
{
|
||||
ActionPointGathering += delta;
|
||||
ActionPoint += (int)ActionPointGathering / 10;
|
||||
ActionPointGathering %= 10;
|
||||
}
|
||||
|
||||
public void UpdateUI()
|
||||
{
|
||||
StatusLabel.Text = $"HP {120}\nAP {ActionPoint}";
|
||||
}
|
||||
|
||||
public override void _InputEvent(Camera3D camera, InputEvent @event, Vector3 position, Vector3 normal, int shapeIdx)
|
||||
{
|
||||
if (@event is InputEventMouseButton mouseButtonEvent)
|
||||
{
|
||||
if (mouseButtonEvent.Pressed)
|
||||
{
|
||||
EmitSignal(SignalName.MousePressed, position);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://igk5375j1keq"]
|
||||
[gd_scene load_steps=4 format=3 uid="uid://dje5jk73mjb6a"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cnilysgmgw8n4" path="res://Temp/Characters/1_19.png" id="1_o3tjt"]
|
||||
[ext_resource type="Script" path="res://Models/BattleCharacter.cs" id="2_vbdi8"]
|
||||
[ext_resource type="Script" path="res://Nodes/BattleCharacterNode.cs" id="2_vbdi8"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_r28jb"]
|
||||
size = Vector3(0.84, 1.46, 0.17)
|
@ -0,0 +1,16 @@
|
||||
namespace CMSGame
|
||||
{
|
||||
public static class GameSaves
|
||||
{
|
||||
public static readonly GameSave Demo1 = new()
|
||||
{
|
||||
Characters = new() {
|
||||
new Character {
|
||||
FamilyName = "腾",
|
||||
GivenName = "牧心",
|
||||
HealthPoint = 80
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in new issue