Files
2025-10-20 09:37:18 +07:00

168 lines
8.0 KiB
C#

using System.Collections.Generic;
namespace BrewMonster.Scripts.Skills
{
public class Range
{
/// <summary>0=point 1=line 2=self sphere 3=target sphere 4=cone 5=self</summary>
public char type; // 0点 1线 2自身球 3目标球 4圆锥形 5自身
public bool IsPoint() { return type == 0; }
public bool IsLine() { return type == 1; }
public bool IsSelfBall() { return type == 2; }
public bool IsTargetBall() { return type == 3; }
public bool IsSector() { return type == 4; }
public bool IsSelf() { return type == 5; }
public bool NoTarget() { return type == 2 || type == 5; }
}
// 占位技能类 // Placeholder Skill class
public class Skill : ElementSkill
{
}
public abstract class SkillStub
{
public const int MIN_LEVEL = 1;
public const int MAX_LEVEL = 10;
// Base info
public uint id; // 唯一锟斤拷锟街憋拷识 // Unique identifier
public int cls; // 职业 // Class/Profession
public ushort[] name; // 锟斤拷锟斤拷锟斤拷锟斤拷 // Skill name
public byte[] nativename; // 锟斤拷锟斤拷锟斤拷 // Native name
public byte[] icon; // 锟斤拷锟斤拷图锟斤拷 // Skill icon
public int max_level; // 锟斤拷锟斤拷锟斤拷蠹侗锟? // Maximum level
public byte type; // 锟斤拷锟斤拷锟斤拷锟? 1锟斤拷锟斤拷锟斤拷锟斤拷 2锟斤拷锟斤拷锟斤拷锟斤拷 3锟斤拷锟斤拷锟劫伙拷 4锟斤拷锟斤拷 5锟斤拷锟斤拷 // Skill type: 1-Normal 2-Special 3-Partner 4-Mount 5-Other
// Execute condition
public bool allow_ride; // 锟斤拷锟斤拷锟叫? // Allow while riding
public short attr; // 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷, 1锟斤拷锟斤拷锟斤拷2锟斤拷3木锟斤拷4水锟斤拷5锟斤拷6锟斤拷 锟斤拷选一 默锟较o拷锟斤拷锟斤拷锟斤拷 // Attribute: 1-Metal 2-Earth 3-Wood 4-Water 5-Fire 6-Special (Choose one, default none)
public int rank; // 锟斤拷锟芥级锟斤拷 // Rank
public int eventflag; // Event flag
public byte is_senior; // Senior flag
public bool is_inherent; // 锟斤拷锟斤拷锟斤拷锟杰o拷锟斤拷锟斤拷学锟斤拷锟斤拷锟斤拷 // Inherent skill, cannot be learned
public bool is_movingcast; // 锟狡讹拷施锟斤拷 // Can cast while moving
public int npcdelay; // NPC delay
public int showorder; // Display order
public byte allow_forms; // Allowed forms
public int apcost; // AP cost
public int apgain; // AP gain
public byte doenchant; // Do enchant
public byte dobless; // Do bless
public int arrowcost; // Arrow cost
public Dictionary<uint, int> pre_skills;
// Execute condition
public bool allow_land; // 陆地有效 // Effective on land
public bool allow_air; // 空中有效 // Effective in air
public bool allow_water; // 水中有效 // Effective in water
public bool notuse_in_combat; // 战斗状态不可用 // Cannot use in combat state
public int restrict_corpse; // 只对尸体有效 // Only effective on corpses
public bool restrict_change; // 是否可以变身 // Whether can transform
public bool restrict_attach; // 是否可以附身 // Whether can possess
public bool auto_attack; // 使用后是否自动攻击 // Whether to auto attack after use
public char time_type; // 瞬发类型 // Instant cast type
public char long_range;
public char posdouble; // 位置选择 // Position selection
public int clslimit; // 职业限制 // Class restriction
public int commoncooldown; // 公共冷却mask bit0-4 技能冷却0-4 bit5-9 物品冷却0-4
// Common cooldown mask bit0-4 skill cooldown 0-4 bit5-9 item cooldown 0-4
public int commoncooldowntime; // 冷却时间,单位毫秒 // Cooldown time in milliseconds
public int itemcost; // 释放时消耗物品 >0有效 // Item cost when casting, effective if >0
// 连击相关 // Combo related
public int combosk_preskill;
public int combosk_interval;
public int combosk_nobreak;
public byte[] effect;
public byte[] aerial_effect;
public Range range;
public bool has_stateattack;
public List<int> restrict_weapons;
public static Dictionary<uint, SkillStub> map;
public static Dictionary<uint, SkillStub> GetMap() => map;
public static Dictionary<uint, List<uint>> inheritSkillMap = new();
public static List<uint> GetInherentSkillList(uint cls)
{
return inheritSkillMap[cls];
}
public static Dictionary<uint, List<uint>> comboSkillMap;
public static Dictionary<uint, List<uint>> GetComboSkMap() => comboSkillMap;
public static SkillStub GetStub(uint i)
{
return GetMap().TryGetValue(i, out var stub) ? stub : null;
}
public static void InitStaticData()
{
var map = GetMap();
foreach (var skill in map)
{
SkillStub sk = skill.Value;
if (sk.is_inherent) GetInherentSkillList((uint)sk.cls).Add(sk.id);
if (sk.combosk_preskill > 0) GetComboSkMap()[(uint)sk.combosk_preskill].Add(sk.id);
}
}
public List<uint> GetPostComboSkill(uint id)
{
var m = GetComboSkMap();
if (m.TryGetValue(id, out var list)) return list;
return null;
}
// 以下为从C++转换的接口 // The following methods are converted from C++
public uint GetId() { return id; }
public int GetCls() { return cls; }
public ushort[] GetName() { return name; }
public byte[] GetIcon() { return icon; }
public int GetMaxLevel() { return max_level; }
public Range GetRange() { return range; }
public int GetItemCost() { return itemcost; }
public bool IsMovingSkill() { return is_movingcast; }
public new byte GetType() { return type; } // 隐藏System.Object.GetType // Hide System.Object.GetType
// 运行时相关虚函数 // Runtime-related virtual functions
public virtual int GetCoolingtime(Skill skill) { return 0; }
public virtual int GetRequiredSp(Skill skill) { return 0; }
public virtual int GetRequiredLevel(Skill skill) { return 0; }
public virtual int GetMaxAbility(Skill skill) { return 0; }
public virtual int GetRequiredItem(Skill skill) { return 0; }
public virtual int GetRequiredMoney(Skill skill) { return 0; }
public virtual int GetRequiredRealmLevel(Skill skill) { return 0; }
public virtual float GetPraydistance(Skill skill) { return 0f; }
public virtual float GetMpcost(Skill skill) { return 0f; }
public virtual int GetExecutetime(Skill skill) { return 1000; }
public virtual bool CheckHpCondition(int hp, int max_hp) { return true; }
public virtual bool CheckComboSkExtraCondition(Skill skill) { return true; }
public virtual int GetIntroduction(Skill skill, ushort[] descBuffer, int descBufferLen, ushort[] titleBuffer) { return 0; }
// 武器有效性检查 // Validate weapon restriction
public bool ValidWeapon(int weapon)
{
if (restrict_weapons != null)
{
int i;
for (i = 0; i < restrict_weapons.Count; i++)
{
if (weapon == restrict_weapons[i])
return true;
}
if (i > 0 && i >= restrict_weapons.Count)
return false;
}
return true;
}
}
}