123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- using CommonAI.Data;
- using CommonAI.Zone;
- using CommonAI.Zone.Formula;
- using CommonAI.Zone.Helper;
- using CommonAI.Zone.Instance;
- using CommonLang;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using XmdsCommon.JSGModule.Interface;
- using XmdsCommon.Plugin;
- using XmdsCommonServer.Plugin;
- using XmdsCommonServer.Plugin.XmdsSkillTemplate.Skills;
- using XmdsCommonServer.XLS.Data;
- using XmdsCommonSkill.Plugin.Buffs;
- using XmdsCommonSkill.Plugin.Interface;
- using XmdsCommonSkill.Plugin.Skills;
- namespace XmdsCommonSkill.Plugin.CardSkill
- {
-
- public abstract class JSGCardSkillBase : XmdsSkillBase, IJSGCardSkill
- {
-
- protected static readonly int BUFF_STOREENERGY = (int)XmdsBuffBase.XmdsBuffList.CARD_STORE_ENERGY;
- protected static readonly byte BUFF_STOREENERGY_TRIGGER_MIN = 3;
- protected static readonly int BUFF_STOREENERGY_DMG = 500;
-
- protected static int BUFF_STOREENERGY_MAXLAYER = 0;
- protected static int BUFF_STOREENERGY_TIME = 10000;
-
- protected static int BUFF_ABILITY_MAXLAYER = 10;
- private int mTriggerSameCards;
-
- public virtual void TriggerCardSkill(XmdsVirtual player, XmdsVirtual hitter, AttackSource source, CardSkillData skillData, int sameNums)
- {
-
- this.mTriggerSameCards = sameNums;
- player.CardModule.TriggerSkillLoadStrength(skillData, sameNums);
- this.OnTriggerCardSkill(player, hitter, source, skillData, sameNums);
- }
- protected override void OnSkillDamagePerEvent(BattleParams param)
- {
- this.OnGetCardSkillDamage(param);
-
- if (param.Hitter.IsPlayerUnit() && param.UseDamageType != DamageType.Heal)
- {
- param.SkillDamagePer = CUtils.CastInt(param.SkillDamagePer * XmdsConfig.Instance.CARD_PLAYER_DMG_PER);
- }
- }
- protected override void OnSkillLogicAftercalDamage(BattleParams param)
- {
-
- IntIntData dmgStrength = param.Attacker.CardModule.GetStrengthInfo(CardStrengthenType.Dmg);
- if (dmgStrength != null && dmgStrength.value1 > 0)
- {
- if(dmgStrength.value1 > 50000)
- {
- log.Warn("JSGCardSkillBase OnSkillLogicAftercalDamage notice: " + this.SkillID + ", " + dmgStrength.value1);
- }
-
- param.HitResult = CUtils.CastInt(param.HitResult * (1.0f + XmdsUnitProp.PER * dmgStrength.value1));
-
- }
-
-
-
-
-
-
-
- }
-
- public virtual int GetEffectID(int skillLv, int sameNums) { return this.SkillID; }
- public virtual void OnTriggerCardSkill(XmdsVirtual player, XmdsVirtual hitter, AttackSource source, CardSkillData skillData, int sameNums) { }
- protected virtual void OnGetCardSkillDamage(BattleParams param) { }
-
- protected override void OnSkillDataChange(GameSkill gs, XmdsVirtual unit)
- {
- unit.CardModule.OnSkillDataChange(gs);
- }
- protected override void OnInitOver(XmdsVirtual unit, GameSkill info)
- {
- unit.CardModule.OnInitOver(info, this);
- if(BUFF_STOREENERGY_MAXLAYER == 0)
- {
- this.LoadStaticData();
- }
- }
-
- protected void unitLaunchSpell(XmdsVirtual launcher, XmdsVirtual hitter, int spellID, bool fromBody = true)
- {
- if(launcher == null)
- {
- string stackInfo = new StackTrace().ToString();
- log.Error("JSGCardSkillBase unitLaunchSpell launch_null 1: " + spellID + ", CardSkillID: " + this.SkillID);
- return;
- }
- else if(hitter == null)
- {
-
-
- InstanceUnit hateUnit = launcher.GetHateSystem().GetHated();
- if(hateUnit == null)
- {
-
- return;
- }
- hitter = hateUnit.Virtual as XmdsVirtual;
- if (hitter == null)
- {
- log.Error("JSGCardSkillBase unitLaunchSpell launch_null 2: " + spellID + ", CardSkillID: " + this.SkillID);
- return;
- }
- }
- LaunchSpell launchSpll = ComSpellTemplate.Instance().GetCardSpell(spellID);
- XmdsVirtual fromUnit = (fromBody || hitter == null) ? launcher : hitter;
- if (hitter == null)
- {
- launcher.mUnit.Parent.unitLaunchSpell(XmdsSkillType.cardSkill, launcher.mUnit, launchSpll, fromUnit.mUnit.X, fromUnit.mUnit.Y);
- }
- else
- {
- launcher.mUnit.Parent.unitLaunchSpell(XmdsSkillType.cardSkill, launcher.mUnit, launchSpll, fromUnit.mUnit.X, fromUnit.mUnit.Y, hitter.mUnit.ID);
- }
- }
- public int GetTriggerSameCards()
- {
- return this.mTriggerSameCards;
- }
-
- public int GetIndex2(int index)
- {
- return this.mTriggerSameCards * 2 + index - 4;
- }
-
- public int GetIndex3(int index)
- {
- return this.mTriggerSameCards * 3 + index - 6;
- }
-
- public int GetIndex4(int index)
- {
- return this.mTriggerSameCards * 4 + index - 8;
- }
-
- private void LoadStaticData()
- {
- var bt1 = XmdsBattleSkill.GetBuffTemplate(BUFF_STOREENERGY);
- if (bt1 != null)
- {
- BUFF_STOREENERGY_MAXLAYER = bt1.MaxOverlay;
- BUFF_STOREENERGY_TIME = bt1.LifeTimeMS;
- }
- else
- {
- BUFF_STOREENERGY_MAXLAYER = 1;
- BUFF_STOREENERGY_TIME = 10000;
- }
-
- var bt2 = XmdsBattleSkill.GetBuffTemplate(CardSkill_QingLongBase.BuffID_TYPE_ABILITY);
- if (bt2 != null)
- {
- BUFF_ABILITY_MAXLAYER = bt2.MaxOverlay;
- }
- else
- {
- BUFF_ABILITY_MAXLAYER = 10;
- }
- }
- protected void AddXuShi(XmdsVirtual player, int addLayers)
- {
- CardLayerRule layerRule = new CardLayerRule(BUFF_STOREENERGY, CardLayerType.Layers, BUFF_STOREENERGY_MAXLAYER);
- NextCardStrengthenInfo data = player.CardModule.AddNextStrengthInfo(CommonAI.Data.CardType.Max, CardStrengthenType.Dmg,
- XmdsConfig.Instance.CARD_STOREENERGY_DMG, addLayers, BUFF_STOREENERGY_TIME, 1, BUFF_STOREENERGY_TRIGGER_MIN, DamageType.Damage, layerRule);
- if(data != null)
- {
- data.bindBuffID = BUFF_STOREENERGY;
- }
- }
- }
- }
|