Files
test/Assets/PerfectWorld/Scripts/Skills/ElementSkill.cs
T
2025-11-07 18:01:47 +07:00

246 lines
10 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Unity.VisualScripting;
namespace BrewMonster.Scripts.Skills
{
public enum skill_type
{
TYPE_ATTACK = 1, // Attack //
TYPE_BLESS = 2, // Blessing // ף
TYPE_CURSE = 3, // Curse //
TYPE_SUMMON = 4, // Summon // Ʒ
TYPE_PASSIVE = 5, // Passive //
TYPE_ENABLED = 6, // Enabled //
TYPE_LIVE = 7, // Live //
TYPE_JUMP = 8, // Jump // ˲
TYPE_PRODUCE = 9, // Production (Crafting) // ()
TYPE_BLESSPET = 10, // Pet Blessing // ף
TYPE_NEUTRALBLESS = 11, // Neutral Blessing // ף
};
public enum range_type
{
TYPE_POINT = 0, //
TYPE_LINE = 1, //
TYPE_SELFSPHERE = 2, // Ϊĵ
TYPE_TARGETSPHERE = 3, // ĿΪĵ
TYPE_TAPER = 4, // Բ׶
TYPE_SLEF = 5, //
};
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct LearnRequirement
{
public int level; // ȼҪ // Level requirement
public int sp; // ܵ // Skill points
public int money; // Ǯ // Money
public int profession; // ְҵ // Profession
public int rank; // ׼ // Rank level
public int realm_level; // ȼ // Realm level
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct PetRequirement
{
public int level; // ȼ // Level requirement
public int sp; // ܵ // Pet skill points
public int list; // б // Pet skill list
public int lsize; // бС // List size
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct GoblinRequirement
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
public int[] genius; // С츳 // Goblin skill talents
public int profession; // ְҵ // Profession
public int sp; // Ԫ // Spirit points
public int money; // Ǯ // Money
public int level; // Сȼ // Goblin level
public int mp; // С鵱ǰħ // Current magic points
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct ComboSkillState
{
public const int MAX_COMBO_ARG = 3;
public uint skillid;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_COMBO_ARG)]
public int[] arg;
}
public struct UseRequirement
{
public int mp; //ħ // Magic points
public int ap; //ŭֵ // Anger points
public int form; //״̬ // Form state
public int weapon; // // Weapon
public int freepackage; //ʣĿ // Remaining inventory slots
public int arrow; //װ֧Ŀ // Number of arrows loaded
public int move_env; //ƶ // Movement environment
public bool is_combat; //Ƿս״̬ // Whether in combat state
public int hp; //ǰhp // Current HP
public int max_hp; //hp // Maximum HP
// public ComboSkillState combo_state; // // Combo skill state
};
public struct GoblinUseRequirement
{
public int mp; //)
public int ap; //()
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
public int[] genius; //С
public int profession; //ְҵ
public int level; //Сȼڼ?
public int move_env; //˵ǰƶ
};
public class SkillStr
{
public virtual string Find(int id) { return ""; }
}
public enum SKILL_STATE
{
SKILL_PERFORM,
SKILL_DONE,
}
public class ElementSkill
{
public const byte FORM_MASK_HIGH = 0xC0;
public const byte FORM_NORMAL = 0; //̬ͨ
public const byte FORM_CLASS = 1; //ְҵ
public const byte FORM_BEASTIE = 2; //С
public static uint NextSkill(uint id = 0)
{
//TODO: Implement this
var map = SkillStub.GetMap();
// if map is empty, return 0
if (map.Count == 0)
return 0;
// If start == 0, return the first entrys value
if (id == 0)
{
var first = map.First();
return first.Value.GetId();
}
// Try to find 'start' key
var keys = map.Keys.OrderBy(k => k).ToList();
int index = keys.IndexOf(id);
if (index == -1 || index + 1 >= keys.Count)
return 0; // no next skill
var nextKey = keys[index + 1];
return map[nextKey].GetId();
}
public static ElementSkill Create(uint id, int n)
{
return Skill.Create(id, n);
}
public virtual Dictionary<uint, int> GetJunior()
{
return new Dictionary<uint, int>();
}
public virtual string GetName() { return null; }
public virtual byte[] GetNativeName() { return null; }
// ?,skill_type
public virtual byte GetType() { return 1; }
// ͼ
public virtual string GetIcon() { return null; }
// ˵
public virtual string GetIntroduction(StringBuilder buf, int len, SkillStr table) { return ""; }
// ְҵ
public virtual int GetCls() { return -1; }
// ȴʱλ
public virtual int GetCoolingTime() { return 5000; }
// ִʱλ
public virtual int GetExecuteTime() { return 1000; }
// Ŀ, 0:Ŀ꣬1:ҪĿ꣬2:Ŀ?, 3:Ŀ?, 4:Ŀ?
public virtual int GetTargetType() { return 0; }
// Чͷž: <-0.001Ŀ -0.001-0.001 ĬϹ룬>0.001 ͷž
public virtual float GetPrayRange(float range, float prayplus) { return 0; }
public static bool IsGoblinSkill(uint id)
{
SkillStub s = SkillStub.GetStub(id);
return s != null && (s.GetCls() == 258);
}
//
public virtual int GetRank() { return 0; }
// ѧϰnҪҼ
public virtual int GetRequiredLevel() { return 0; }
// ѧϰnҪļܵ
public virtual int GetRequiredSp() { return 0; }
// ѧϰnҪļ
public virtual int GetRequiredBook() { return 0; }
// ѧϰҪǮ
public virtual int GetRequiredMoney() { return 0; }
// ѧϰ󾳽ȼ?
public virtual int GetRequiredRealmLevel() { return 0; }
// ǰ
public virtual Dictionary<uint, int> GetRequiredSkill() => new Dictionary<uint, int>();
// ʾ˳
public virtual int GetShowOrder() { return 0; }
// üܼ
public virtual int SetLevel(int level) { return 0; }
// 󼶱?
public virtual int GetMaxLevel() { return 0; }
// Ƿ
public virtual bool IsWarmup() { return false; }
// ʹúǷԶ
public virtual bool IsAutoAttack() { return false; }
// ˲
public virtual bool IsInstant() { return false; }
// Ƿ?
public virtual bool IsDurative() { return false; }
// ɱ˷Χ
public virtual int GetRangeType() { return 0; }
// ͷŻС桢ˮ
public virtual int GetCastEnv() { return 0; }
// ȡСѧϰͷż
public virtual int GetRequiredGenius(int idSkill) { return 0; }
// Чļ
public virtual byte[] GetEffect() { return null; }
public virtual byte[] GetElseEffect() { return null; }
// ʹҪMP
public virtual int GetMpCost() { return 1; }
// ʹҪAP
public virtual int GetApCost() { return 0; }
// ֧
public virtual int GetArrowCost() { return 0; }
// ж
public virtual bool ValidWeapon(int w) { return true; }
// 0, ɹ1ƥ䣻2, mp㣻3λ㣻4?5ID, 6δѡĿ
public int Condition(UseRequirement info)
{
return 0;
}
public virtual bool IsAllowLand() { return true; }
public virtual bool IsAllowWater() { return true; }
public virtual bool IsAllowAir() { return true; }
public virtual bool GetNotuseInCombat() { return false; }
//Ƿƶʩ
public virtual bool IsMovingSkill() { return false; }
// ܷڵǰ״̬ʹ
public bool IsValidForm(byte form)
{
byte form_type = (byte)((form & FORM_MASK_HIGH) >> 6);
return ((GetAllowForms() & (1 << form_type)) != 0);
}
public virtual byte GetAllowForms() { return 0; }
public virtual bool Interrupt() { return true; }
}
}