123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- using CommonAI.Data;
- using CommonAI.ZoneServer.JSGModule;
- using CommonLang.Log;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using XmdsCommon.JSGModule;
- using XmdsCommon.JSGModule.Interface;
- using XmdsCommon.Plugin;
- using XmdsCommonServer.Plugin;
- using CommonAI.Zone.Formula;
- using XmdsCommonServer.XLS.Data;
- using XmdsCommonServer.Plugin.CardSkill;
- using CommonAI.Zone.Helper;
- namespace XmdsCommonSkill.Plugin.CardSkill
- {
- /** 怪物受击,攒卡牌珠技能模块 */
- public class JSGMonsterCardModule : JSGCardModuleBase
- {
- //protected static Logger log = LoggerFactory.GetLogger("JSGPlayerCardModule");
- //技能触发数据
- private CardSkillData mTriggerSkill;
- public JSGMonsterCardModule(XmdsVirtual owner)
- {
-
- }
- protected override bool OnInit(XmdsVirtual owner, bool notifyClient)
- {
- if(mCardData == null)
- {
- mCardData = new JSGMonsterCardData();
- }
- mTriggerSkill = null;
- IJSGCardSkill cardSkill = owner.SkillHelper.GetPlayerSkillById(XmdsComSrvData.BOSS_CARD_SKILLID) as IJSGCardSkill;
- if(cardSkill == null)
- {
- log.Error("JSGMonsterCardModule找不到怪物卡牌技能数据:" + this.mOwner.mUnit.Info.ID);
- return false;
- }
- mTriggerSkill = new CardSkillData(XmdsComSrvData.BOSS_CARD_SKILLID, CardType.Max);
- mTriggerSkill.skilLv = 0;
- mTriggerSkill.skill = cardSkill;
- this.ReSet(true, notifyClient);
- return true;
- }
- protected override void ReSet(bool IsInit, bool notifyClient)
- {
- base.ReSet(IsInit, notifyClient);
- if(!IsInit)
- {
- this.mCardData.ReSet(this.mOwner);
- }
- }
- public override void OnHitDamage(XmdsVirtual attacker, AttackSource source, int damage, DamageType damageType)
- {
- if(mTriggerSkill == null || attacker == null || this.mOwner == null || !attacker.IsPlayerUnit() || source.FromSkillType != XmdsSkillType.cardSkill
- || mNextGetCardTime > CommonLang.CUtils.localTimeMS || !JSGModule.RandomPrecent(this.mCardCfg.rate))
- {
- return;
- }
- this.mNextGetCardTime = CommonLang.CUtils.localTimeMS + this.mCardCfg.interval;
- int cardIndex = this.mOwner.mUnit.RandomN.Next() % ((int)CardType.Max);
- #if JSG_CARD_TEST
- log.Warn("----boss获得卡牌: " + (CardType)cardIndex);
- #endif
- CardTriggerResult result = mCardData.AddCard(this.mOwner, new GenCardData((CardType)cardIndex, 1));
- if(result == null)
- {
- return;
- }
- //result.type = CardType.ZhuQue;
- #if JSG_CARD_TEST
- log.Warn("----boss触发卡牌技能: " + result.type);
- #endif
- mCardData.SendTriggerInfo(this.mOwner, result, mTriggerSkill.skillId, result.cardData);
- mTriggerSkill.type = result.type;
-
- //改成延时触发
- //mTriggerSkill.skill.TriggerCardSkill(this.mOwner, attacker, source, mTriggerSkill, result.sameNums);
- base.mTriggerSkillDelay.init(mTriggerSkill.skill, this.mOwner, attacker, source, mTriggerSkill, result.sameNums);
- }
- }
- }
|