246 lines
10 KiB
C#
246 lines
10 KiB
C#
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 entry’s 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���������������?5������ID, 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; }
|
||
}
|
||
} |