public override void OnDie(SkillObj self, SkillObj attacker, BuffInfo_New buffInfo, BuffConfig_New buffConfig) { return; if (self.GetBuffIntParam(buffInfo, Key_Int_Bombed_BuffInfo) != Key_Int_Bombed_Value) { var targetSelectName = self.GetTargetSelect(buffConfig); var targetSelect = BattleModule.GetTargetSelect(targetSelectName); if (targetSelect == null) { self.LogInfo("targetSelect == null buffId:[{0}] targetSelectName:[{1}]".F(self.GetBuffID(buffInfo), targetSelectName)); return; } var targetTypeName = self.GetTargetType(buffConfig); var targetType = BattleModule.GetTargetType(targetTypeName); if (targetType == null) { self.LogInfo("targetSelect == null buffId:[{0}] targetType:[{1}]".F(self.GetBuffID(buffInfo), targetTypeName)); return; } var targets = BattleModule.GetTargets(self, targetSelect, targetType, buffInfo, buffConfig); foreach (var tar in targets.Where(t => !t.IsDead())) { OnEffect(self, tar, buffInfo, buffConfig); } } }
public override bool InitSkillInfo(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig) { bool ret = base.InitSkillInfo(self, skillInfo, skillConfig); var targetSelectName = "Range"; var targetSelect = BattleModule.GetTargetSelect(targetSelectName); if (targetSelect == null) { self.LogInfo("targetSelect == null skillId:[{0}] targetSelectName:[{1}]".F(self.GetSkillID(skillInfo), targetSelectName)); Debug.Assert(false, "targetSelect == null skillId:[{0}] targetSelectName:[{1}]".F(self.GetSkillID(skillInfo), targetSelectName)); return(false); } var targetTypeName = "Harm"; var targetType = BattleModule.GetTargetType(targetTypeName); if (targetType == null) { self.LogInfo("targetSelect == null skillId:[{0}] targetType:[{1}]".F(self.GetSkillID(skillInfo), targetTypeName)); Debug.Assert(false, "targetSelect == null skillId:[{0}] targetType:[{1}]".F(self.GetSkillID(skillInfo), targetTypeName)); return(false); } var targets = BattleModule.GetTargets(self, targetSelect, targetType, skillInfo, skillConfig).ToList(); if (targets == null || targets.Count <= 0) { return(true); } int count = self.GetSkillIntParam(skillConfig, key_SummonCount_SkillConfig); int realCount = 0; int index = 0; foreach (var tar in targets) { if (index < count) { self.SetSkillIntParam(skillInfo, key_SummonTraceTarget_SkillInfo + index++, tar.GetID()); realCount++; } else { break; } } if (index < count) { var tank = targets.OrderBy(t => t.GetHP()).FirstOrDefault(); for (int i = index; i < count; i++) { self.SetSkillIntParam(skillInfo, key_SummonTraceTarget_SkillInfo + i, tank.GetID()); realCount++; } } self.SetSkillIntParam(skillInfo, key_SummonIdx_SkillInfo, 0); ret = true; return(ret); }
public virtual bool InitBuffInfo(SkillObj self, SkillObj srcObj, BattleReason reason, BuffInfo_New buffInfo, BuffConfig_New buffConfig, bool RefreshGUID = true) { var buffId = self.GetBuffID(buffConfig); self.SetBuffId(buffInfo, buffId); if (RefreshGUID) { var guid = BattleModule.BattleID; self.SetBuffGuid(buffInfo, guid); } self.SetBuffStateIndex(buffInfo, 0); if (srcObj != null) { if (srcObj.GetParentID() > 0) { self.SetSrcID(buffInfo, srcObj.GetParentID()); } else { self.SetSrcID(buffInfo, srcObj.GetID()); } } var startLogicStateName = self.GetLogicState(buffConfig, 0); var startLogicState = BattleModule.GetBuffLogicState(startLogicStateName); if (startLogicState == null) { self.LogInfo("startLogicState == null BuffId:[{0}] startLogicStateName:[{1}]".F(buffId, startLogicStateName)); return(false); } //init startLogicState.InitBuff(self, buffInfo, buffConfig, 0); startLogicState.InitState(self, buffInfo, buffConfig, 0); var targetSelectName = self.GetTargetSelect(buffConfig); if (targetSelectName != null) { var targetSelect = BattleModule.GetTargetSelect(targetSelectName); if (targetSelect == null) { self.LogInfo("targetSelect == null buffId:[{0}] targetSelectName:[{1}]".F(buffId, targetSelectName)); return(false); } targetSelect.Init(self, buffInfo, buffConfig); } return(true); }
public virtual void Tick(SkillObj self, BuffInfo_New buffInfo, BuffConfig_New buffConfig) { if (!CommonCheck(self, buffInfo, buffConfig)) { return; } var logicState = BattleModule.GetBuffLogicState(buffInfo, self); if (logicState == null) { return; } var ret = logicState.Tick(self, buffInfo, buffConfig); switch (ret) { case LogicStateTickRet.TimeFinish: BuffOnEnd(self, buffInfo, buffConfig); break; case LogicStateTickRet.NextState: int index = self.GetBuffStateIndex(buffInfo); string nextStateName = self.GetLogicState(buffConfig, ++index); if (nextStateName == null || nextStateName.Equals("")) { BuffOnEnd(self, buffInfo, buffConfig); return; } var nextLogicState = BattleModule.GetBuffLogicState(nextStateName); if (nextLogicState == null) { self.LogInfo("startLogicState {0} not found".F(nextStateName)); return; } double fixTime = logicState.OnStateChanged(nextStateName, self, buffInfo, buffConfig); self.SetBuffStateIndex(buffInfo, index); nextLogicState.InitState(self, buffInfo, buffConfig, fixTime); self.NotifyBuffInfo(buffInfo, BattleInfoNotifyType.ChangeState_Buff, BattleNotifyTime.TickEnd); break; case LogicStateTickRet.OnEffect: //var srcObj = self.GetBuffSrcObj(buffInfo); { var targetSelectName = self.GetTargetSelect(buffConfig); var targetSelect = BattleModule.GetTargetSelect(targetSelectName); if (targetSelect == null) { self.LogInfo("targetSelect == null buffId:[{0}] targetSelectName:[{1}]".F(self.GetBuffID(buffInfo), targetSelectName)); return; } var targetTypeName = self.GetTargetType(buffConfig); var targetType = BattleModule.GetTargetType(targetTypeName); if (targetType == null) { self.LogInfo("targetSelect == null buffId:[{0}] targetType:[{1}]".F(self.GetBuffID(buffInfo), targetTypeName)); return; } var targets = BattleModule.GetTargets(self, targetSelect, targetType, buffInfo, buffConfig); foreach (var tar in targets) { OnEffect(self, tar, buffInfo, buffConfig); } } break; } }