diff --git a/Assets/PerfectWorld/Scripts/ModelFiles/CECComboSkillState.cs b/Assets/PerfectWorld/Scripts/ModelFiles/CECComboSkillState.cs index 86aacf278f..385793822a 100644 --- a/Assets/PerfectWorld/Scripts/ModelFiles/CECComboSkillState.cs +++ b/Assets/PerfectWorld/Scripts/ModelFiles/CECComboSkillState.cs @@ -50,6 +50,7 @@ namespace BrewMonster public void SetComboSkillState(Dictionary 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) { diff --git a/Assets/PerfectWorld/Scripts/Skills/ElementSkill.cs b/Assets/PerfectWorld/Scripts/Skills/ElementSkill.cs index 68a20e1ced..e8737d2114 100644 --- a/Assets/PerfectWorld/Scripts/Skills/ElementSkill.cs +++ b/Assets/PerfectWorld/Scripts/Skills/ElementSkill.cs @@ -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���������������?5������ID, 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(); } diff --git a/Assets/PerfectWorld/Scripts/Skills/skill.cs b/Assets/PerfectWorld/Scripts/Skills/skill.cs index 5881b4dba5..71bf2365ec 100644 --- a/Assets/PerfectWorld/Scripts/Skills/skill.cs +++ b/Assets/PerfectWorld/Scripts/Skills/skill.cs @@ -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; } diff --git a/Assets/PerfectWorld/Scripts/UI/GamePlay/AUIImagePicture.cs b/Assets/PerfectWorld/Scripts/UI/GamePlay/AUIImagePicture.cs index 16f11f4f68..9f885cfeb8 100644 --- a/Assets/PerfectWorld/Scripts/UI/GamePlay/AUIImagePicture.cs +++ b/Assets/PerfectWorld/Scripts/UI/GamePlay/AUIImagePicture.cs @@ -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 { diff --git a/Assets/PerfectWorld/Scripts/UI/GamePlay/CdlgQuickBar.cs b/Assets/PerfectWorld/Scripts/UI/GamePlay/CdlgQuickBar.cs index 95f32fe94b..449eb1d7ab 100644 --- a/Assets/PerfectWorld/Scripts/UI/GamePlay/CdlgQuickBar.cs +++ b/Assets/PerfectWorld/Scripts/UI/GamePlay/CdlgQuickBar.cs @@ -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); } } } diff --git a/Assets/Scripts/CECHostPlayer.cs b/Assets/Scripts/CECHostPlayer.cs index a3bdc42482..520f409bbe 100644 --- a/Assets/Scripts/CECHostPlayer.cs +++ b/Assets/Scripts/CECHostPlayer.cs @@ -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