123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using CommonAI.Data;
- using XmdsCommon.JSGModule;
- using XmdsCommon.JSGModule.Interface;
- using XmdsCommonServer.XLS.Data;
- using XmdsCommonServer.Plugin;
- using XmdsCommonServer.Plugin.CardSkill;
- using CommonAI.Zone.Formula;
- namespace XmdsCommonSkill.Plugin.CardSkill
- {
- /** 卡牌接口类 */
- public interface JSGCardInterface
- {
- }
- // 卡牌权重变更类型
- public enum CardRateChgType : byte
- {
- Add = 0,
- Del = 1,
- Set = 2,
- Double = 3,
- }
- // 卡牌强化类型
- public enum CardStrengthenType : byte
- {
- None = 0,
- Dmg = 1, // 普通伤害
- Heal = 2, // 治疗强化
- HuDun = 3, // 护盾强化
- Shield = 4, // 破定强化
- //LaunchSpell = 5, // 释放法术
- //RemoveCard_LaunchSpell= 6, // 移除当前获得的牌球,并释放法术
- //Dmg_Store = 7, // 特殊----蓄势:按层数叠加伤害, 需要三四球以上,并且新加的会修改所有的截至时间
- //Dmg_SpecialLayer = 8, // 特殊-XX之力:有叠层和最高层
- Max,
- }
- //卡牌珠生成原来
- public enum CreateCardBallSource : byte
- {
- Normal = 0, // 默认产生(攻击)
- CardLogic = 1, // 卡牌内部逻辑
- }
- // 获得卡牌信息
- public class GetCardData
- {
- public CardType cardType;
- public long time;
- public void Set(CardType card)
- {
- this.cardType = card;
- this.time = CommonLang.CUtils.localTimeMS;
- }
- public void ReSet()
- {
- this.cardType = CardType.Max;
- this.time = 0;
- }
- }
- // 卡牌本次强化效果
- public class CardStrengthData
- {
- public CardStrengthenType type = CardStrengthenType.None; // 效果类型
- public IntIntData data; // 强化效果附带信息1
- }
- // 卡牌下次强化规则
- public class CardLayerRule
- {
- public int uniqueID;
- public CardLayerType layerType;
- public int maxLayers;
- public CardLayerRule(int uniqueID, CardLayerType type, int maxLayer = 0)
- {
- this.uniqueID = uniqueID;
- this.layerType = type;
- this.maxLayers = maxLayer;
- }
- public bool IsValid()
- {
- if(layerType == CardLayerType.Layers)
- {
- return uniqueID > 0 && maxLayers > 0;
- }
- else if(layerType == CardLayerType.Replace)
- {
- return uniqueID > 0;
- }
- return true;
- }
- public override string ToString()
- {
- return uniqueID + "-" + layerType + "-" + maxLayers;
- }
- }
- // 下一次卡牌强化
- public class NextCardStrengthenInfo
- {
- //标识头
- public CardLayerRule layerRules;
- public CardType pointCard; // 如果为Max:表示全体增强
- public byte needSames; // <=0 不限制,否则为需要相同球数
- public DamageType needDmgType = DamageType.None; // 否则只能伤害技能触发
- public CardStrengthenType type; // 效果类型
- public int value1; // 强化效果附带信息1
- public int value2; // 强化附带效果2
- public long validTime; // 有效时间
- public int validTimes = -1; // 有效次数,<0无限次
- public int bindBuffID; // 针对那种绑定buff 的,效果消失同步buff消失
- public void Replace(NextCardStrengthenInfo data)
- {
- this.pointCard = data.pointCard;
- this.needSames = data.needSames;
- this.needDmgType = data.needDmgType;
- this.type = data.type;
- this.value1 = data.value1;
- this.value2 = data.value2;
- this.validTime = data.validTime;
- this.validTimes = data.validTimes;
- this.bindBuffID = data.bindBuffID;
- }
- public void AddLayers(NextCardStrengthenInfo data)
- {
- this.value1 = data.value1;
- this.value2 = Math.Min(this.value2 + data.value2, data.layerRules.maxLayers);
- this.validTime = data.validTime;
- this.validTimes = data.validTimes;
- }
- }
- //卡牌权重变更数据
- public class CardRateChgData
- {
- public int uniqueID; //绑定唯一id
- public CardType cardType;
- public CardRateChgType chgType;
- public bool isPrecent = true;
- public short value;
- public short validTimes = -1; // 有效次数,<0无限次
- public long validTime; // 有效时间
- public void copy(CardRateChgData data)
- {
- this.cardType = data.cardType;
- this.chgType = data.chgType;
- this.isPrecent = data.isPrecent;
- this.value = data.value;
- this.validTimes = data.validTimes;
- this.validTime = data.validTime;
- }
- }
- // 当前生成卡牌信息
- public class GenCardData
- {
- public CardType type;
- public byte nums;
- public GenCardData(CardType type, int nums)
- {
- this.type = type;
- this.nums = (byte)nums;
- }
- }
- // 卡牌打出结果
- public class CardTriggerResult
- {
- public CardType type;
- public byte sameNums;
- public byte[] cardData = new byte[(int)CardType.Max];
- }
- // 卡牌技能数据
- public class CardSkillData
- {
- public IJSGCardSkill skill;
- public CardType type;
- public int skillId;
- public short skilLv;
- private int weight;
- public DamageType dmgType = DamageType.None; //技能是否有伤害
- public CardSkillData(int skillId, CardType type)
- {
- this.skillId = skillId;
- this.type = type;
- }
- public void setWeight(XmdsVirtual unit)
- {
- if(this.type < CardType.Max)
- {
- this.weight = unit.MirrorProp.cardWeight[(int)this.type];
- }
- }
- public int GetWeight()
- {
- return this.weight;
- }
- }
- //触发卡牌技能延时数据
- public class TriggerCardSkillDelayData
- {
- public long validTime;
- public IJSGCardSkill skill;
- public XmdsVirtual launcher;
- public XmdsVirtual target;
- public CardSkillData skillData;
- public AttackSource source;
- public byte sames;
- public void init(IJSGCardSkill skill, XmdsVirtual launcher, XmdsVirtual target, AttackSource source, CardSkillData skillData, byte sames)
- {
- this.validTime = CommonLang.CUtils.localTimeMS + JSGCardModuleBase.S_TRIGGER_DLAY;
- this.skill = skill;
- this.launcher = launcher;
- this.target = target;
- this.source = source;
- this.skillData = skillData;
- this.sames = sames;
- }
- public void CheckTriggerSkill()
- {
- if(validTime <= 0 || validTime > CommonLang.CUtils.localTimeMS)
- {
- return;
- }
- this.validTime = 0;
- if(this.launcher != null && this.launcher.mUnit.IsActive)
- {
- this.skill.TriggerCardSkill(this.launcher, this.target, this.source, this.skillData, this.sames);
- // 分发触发事件
- this.launcher.DispatchTriggerCardSkillEvent(this.launcher, this.target, this.skillData.type, this.sames);
- }
- }
- }
- }
|