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 bool IsActionLimited(SkillObj self, ActionLimitType limit, BuffInfo_New buffInfo, BuffConfig_New buffConfig) { if (!CommonCheck(self, buffInfo, buffConfig)) { return(false); } var logicState = BattleModule.GetBuffLogicState(buffInfo, self); if (logicState == null) { return(false); } var ret = logicState.IsActionLimited(self, limit, buffInfo, buffConfig); return(ret); }
public virtual double DataFix(SkillObj self, PropertyType pType, double pValue, BuffInfo_New buffInfo, BuffConfig_New buffConfig) { if (!CommonCheck(self, buffInfo, buffConfig)) { return(pValue); } var logicState = BattleModule.GetBuffLogicState(buffInfo, self); if (logicState == null) { return(pValue); } if (logicState.NeedDataFix(self, pType, pValue, buffInfo, buffConfig)) { pValue = OnDataFix(self, pType, pValue, buffInfo, buffConfig); } return(pValue); }
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; } }