done skill ui execute

This commit is contained in:
VDH
2026-02-05 17:26:58 +07:00
parent 1edb9899b5
commit b3e5f2ae61
6 changed files with 91 additions and 10 deletions
@@ -50,6 +50,7 @@ namespace BrewMonster
public void SetComboSkillState(Dictionary<uint, int> skillDic, ref ComboSkillState state)
{
BMLogger.LogError($"SetComboSkillState: skillid={state.skillid}, arg0={state.arg[0]}, arg1={state.arg[1]}, arg2={state.arg[2]}");
m_comboSkillState = state;
if (state.skillid != 0)
{
@@ -191,7 +191,7 @@ namespace BrewMonster.Scripts.Skills
return "";
}
// ˵
public virtual void GetIntroduction(StringBuilder buf, SkillStr table) { }
public virtual void GetIntroduction(StringBuilder buf, SkillStr table) { }
// ְҵ
public virtual int GetCls() { return -1; }
// ȴʱλ
@@ -250,7 +250,7 @@ namespace BrewMonster.Scripts.Skills
return ret;
}
public virtual int GetRequiredRealmLevel() { return 0; }
public static int GetRequiredRealmLevel(uint id, int level)
public static int GetRequiredRealmLevel(uint id, int level)
{
Skill s = Skill.Create(id, level);
if (s == null)
@@ -324,11 +324,67 @@ namespace BrewMonster.Scripts.Skills
// ж
public virtual bool ValidWeapon(int w) { return true; }
// 0, ɹ1ƥ䣻2, mp㣻3λ㣻4?5ID, 6δѡĿ
public int Condition(uint id, UseRequirement info, int ilevel)
{
skill = Skill.Create(id, ilevel);
if (skill == null)
return 5;
ComboArg arg = skill.GetPlayer().GetComboarg();
if (info.combo_state.arg != null)
{
for (int i = 0; i < ComboSkillState.MAX_COMBO_ARG; i++)
{
arg.SetValue((uint)i, info.combo_state.arg[i]);
}
}
int ret = ((ElementSkill)skill).Condition(info);
return ret;
}
public int Condition(UseRequirement info)
{
if (info.arrow < GetArrowCost())
return 9;
if (!ValidWeapon(info.weapon))
return 1;
if (info.mp < GetMpCost())
return 2;
int form_type = (info.form & FORM_MASK_HIGH) >> 6;
if ((GetAllowForms() & (1 << form_type)) == 0)
return 7;
if (info.ap < GetApCost())
return 8;
if (info.freepackage == 0 && GetTargetType() == 3)
return 10;
// ÒÆ¶¯»·¾³
if ((info.move_env == 0 && !IsAllowLand()) ||
(info.move_env == 1 && !IsAllowWater()) ||
(info.move_env == 2 && !IsAllowAir()))
return 3;
if (info.is_combat && GetNotuseInCombat())
return 11;
if (!CheckHpCondition(info.hp, info.max_hp))
return 12;
int preskill = GetComboSkPreSkill();
if (preskill != 0)
{
if (info.combo_state.skillid != (uint)preskill
|| !CheckComboSkExtraCondition())
return 13;
}
return 0;
}
// 检查HP条件 // Check HP condition
public virtual bool CheckHpCondition(int hp, int max_hp) { return true; }
// 检查连击技能额外条件 // Check combo skill extra condition
public virtual bool CheckComboSkExtraCondition() { return true; }
public virtual bool IsAllowLand() { return true; }
public virtual bool IsAllowWater() { return true; }
public virtual bool IsAllowAir() { return true; }
@@ -369,7 +425,7 @@ namespace BrewMonster.Scripts.Skills
comboArg.SetValue((uint)i, argValue);
}
if (skill.CheckComboSkExtraCondition())
if (((ElementSkill)skill).CheckComboSkExtraCondition())
{
result[skill.GetId()] = skill.GetComboSkInterval();
}
+10 -1
View File
@@ -104,7 +104,10 @@ namespace BrewMonster.Scripts.Skills
return stub.GetIcon();
}
public int GetAbility() { return SkillWrapper.Instance.GetAbility(id); }
public bool CheckComboSkExtraCondition() { return stub.CheckComboSkExtraCondition(this); }
// 检查施放时hp条件 // Check HP condition when casting
public override bool CheckHpCondition(int hp, int max_hp) { return stub.CheckHpCondition(hp, max_hp); }
public override bool CheckComboSkExtraCondition() { return stub.CheckComboSkExtraCondition(this); }
public override byte GetAllowForms() { return stub.allow_forms; }
public override string GetName() { return stub.GetName(); }
public override float GetPrayRange(float range, float prayplus)
@@ -302,7 +305,13 @@ namespace BrewMonster.Scripts.Skills
public virtual float GetPraydistance(Skill skill) { return 0f; }
public virtual float GetMpcost(Skill skill) { return 0f; }
public virtual int GetExecutetime(Skill skill) { return 1000; }
// 检查HP条件 // Check HP condition
// 默认返回true,子类可以重写以检查HP百分比范围 // Default returns true, subclasses can override to check HP percentage range
// 例如:return hp >= max_hp / 100.0f * minPercent && hp <= max_hp / 100.0f * maxPercent;
public virtual bool CheckHpCondition(int hp, int max_hp) { return true; }
// 检查连击技能额外条件 // Check combo skill extra condition
// 默认返回true,子类可以重写以检查连击参数等条件 // Default returns true, subclasses can override to check combo arguments etc.
// 例如:return skill.GetPlayer().GetComboarg().GetValue(0) == 5;
public virtual bool CheckComboSkExtraCondition(Skill skill) { return true; }
public virtual int GetIntroduction(Skill skill, StringBuilder descBuffer, string titleBuffer) { return 0; }
@@ -45,14 +45,28 @@ namespace BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay
{
pSC = pvData;
}
public void SetInteract(bool isInteract)
{
if (isInteract)
{
skillbutton.interactable = true;
skillImage.color = Color.white;
}
else
{
skillImage.color = Color.gray;
skillbutton.interactable = false;
}
}
public CECShortcut GetDataPtr() => pSC;
public void Execute()
{
if (pSC != null)
{
pSC.Execute();
StartCoroutine(CooldownRoutine());
SetInteract(false);
}
else
{
@@ -111,11 +111,13 @@ namespace BrewMonster
{
if (pHost.CheckSkillCastCondition(pSkill) == 0)
{
//pCell.SetColor(A3DCOLORRGB(255, 255, 255));
//BMLogger.LogError("HoangDev: QuickBar Skill Not Interact: " + (uint)pSkill.GetSkillID() + " : " + ElementSkill.GetIcon((uint)pSkill.GetSkillID()));
pCell.SetInteract(true);
}
else
{
//pCell.SetColor(A3DCOLORRGB(128, 128, 128));
//BMLogger.LogError("HoangDev: QuickBar Skill Interact: " + (uint)pSkill.GetSkillID() + " : " + ElementSkill.GetIcon((uint)pSkill.GetSkillID()));
pCell.SetInteract(false);
}
}
}
+1 -2
View File
@@ -4841,10 +4841,9 @@ namespace BrewMonster
Info.arrow = pArrow.GetCount();
}
// Call ElementSkill Condition check
if (pSkill.SkillCore != null)
{
return pSkill.SkillCore.Condition(Info);
return pSkill.SkillCore.Condition((uint)pSkill.GetSkillID(),Info, pSkill.GetSkillLevel());
}
return 0; // Success