public override void Execute() { //Made this code because it miss the state for caster and target //Another solution : add the effect in the database because isn't in d2o files. //WARNING : needs to debuff when carried actor is moving, maybe use target.InstantMoved ? if (this.Caster.Carrier == null && this.Caster.Carried == null) { var id = this.Caster.PopNextBuffId(); var target = this.Fight.GetOneFighter(this.TargetedCell); var effect = new EffectBase { Duration = -1 }; var actionId = (short)ActionsEnum.ACTION_CARRY_CHARACTER; var casterStateId = (uint)SpellStatesEnum.Carrying; var targetStateId = (uint)SpellStatesEnum.Carried; var casterState = Singleton <SpellManager> .Instance.GetSpellState(casterStateId); var targetState = Singleton <SpellManager> .Instance.GetSpellState(targetStateId); StateBuff casterBuff = new StateBuff(id, this.Caster, this.Caster, effect, this.Spell, false, actionId, casterState); StateBuff targetBuff = new StateBuff(id, target, this.Caster, effect, this.Spell, false, actionId, targetState); this.Caster.AddAndApplyBuff(casterBuff); target.AddAndApplyBuff(targetBuff); base.Execute(); } }
private void InitializeFirstButtonCallbacks() { buttonsCollider.SetActive(false); firstButtonHide.onButtonSelect += () => ConsoleHide(); firstButtonVoice.onButtonSelect += () => musicManager.VoicePlay(); firstButtonBacklog.onButtonSelect += () => OnOtherShow(backlogRenderManager); firstButtonSkip.onButtonSelect += () => { stateMachine.SetStateBuff(StateBuff.Skip); DisableButtons(); }; firstButtonSkip.onButtonRelease += () => stateMachine.SetStateBuff(StateBuff.Normal); firstButtonAuto.onButtonSelect += () => { stateMachine.SetStateBuff(StateBuff.Auto); DisableButtons(); }; firstButtonAuto.onButtonRelease += () => stateMachine.SetStateBuff(StateBuff.Normal); firstButtonNext.onJudgeEnable = () => { BaseState state = stateMachine.CurrentState; StateBuff buff = stateMachine.StateBuff; if (state == RunAnimateState.Instance || state == RunWaitState.Instance) { if (buff == StateBuff.Normal) { if (choiceItemList.Count == 0) { return(true); } } } return(false); }; firstButtonNext.onButtonSelect += () => { stateMachine.SetStateBuff(StateBuff.Next); DisableButtons(); }; firstButtonNext.onButtonRelease += () => stateMachine.SetStateBuff(StateBuff.Normal); firstButtonQS.onButtonSelect += () => { stageContextManager.SavePlayerRecord(); stageContextManager.SaveStoryRecord(0); }; firstButtonQL.onButtonSelect += () => { stageContextManager.SavePlayerRecord(); stageContextManager.LoadStoryRecord(0); }; firstButtonSave.onButtonSelect += () => { slRenderManager.IsSaveMode = true; OnOtherShow(slRenderManager); }; firstButtonLoad.onButtonSelect += () => { slRenderManager.IsSaveMode = false; OnOtherShow(slRenderManager); }; firstButtonConfig.onButtonSelect += () => OnOtherShow(configRenderManager); firstButtonExit.onButtonSelect += () => { OnConfirmShow(); }; Messenger.AddListener <StateBuff>("SetStateBuff", FirstButtonStateBuffCallback); }
private void FirstButtonStateBuffCallback(StateBuff stateBuff) { switch (stateBuff) { case StateBuff.Normal: firstButtonSkip.SetNormal(); firstButtonAuto.SetNormal(); firstButtonNext.SetNormal(); EnableButtons(); break; case StateBuff.Skip: firstButtonAuto.SetNormal(); firstButtonNext.SetNormal(); break; case StateBuff.Auto: firstButtonSkip.SetNormal(); firstButtonNext.SetNormal(); break; case StateBuff.Next: firstButtonSkip.SetNormal(); firstButtonAuto.SetNormal(); break; } }
/// <summary> /// Ajoute au royalmouth un buff d'invulnérabilité /// </summary> private void AddInvulnerabilityBuff() { StateBuff buff = new StateBuff(Fighter.BuffIdProvider.Pop(), Fighter, Fighter, InitmouthLevel, InvulnerabilityEffect, InitmouthSpellId, false, FightDispellableEnum.REALLY_NOT_DISPELLABLE, SpellStateRecord.GetState(InvulnerabilityEffect.Value)); Fighter.AddAndApplyBuff(buff); }
protected override void OnUpdateStageContext() //Engine_ChoiceCreate(myFirstMark,*DL_Choice_0*,true,<Engine_ScriptLoadFile(*SC_SomeScriptName*)>,mySecondMark,*DL_Choice_1*,false,<Engine_ScriptLoadFile(*SC_OtherScriptName*)>) { if (paraList.Count == 0 || paraList.Count % 4 != 0) { throw new System.Exception("EngineChoiceCreateNode"); } StateMachineManager stateMachine = PachiGrimoire.I.StateMachine; stateMachine.TransferStateTo(ChoiceWaitState.Instance); StateBuff stateBuff = stateMachine.StateBuff; if (stateBuff == StateBuff.Next) { stateMachine.SetStateBuff(StateBuff.Normal); } List <ChoiceItem> choiceItemList = new List <ChoiceItem>(); string mark; string dlIndex; bool canBeSelected; string onSelectedScirptContext; for (int i = 0; i < paraList.Count; i += 4) { mark = paraList[i]; dlIndex = paraList[i + 1]; canBeSelected = bool.Parse(paraList[i + 2]); onSelectedScirptContext = paraList[i + 3]; ChoiceItem choiceItem = new ChoiceItem(mark, dlIndex, canBeSelected, onSelectedScirptContext); choiceItemList.Add(choiceItem); } StageRenderManager.I.ChoiceCreate(choiceItemList); }
protected override void ThenUpdateWhat() { BaseState state = stateMachine.CurrentState; if (state == SleepState.Instance) { return; } if (isConfirmWorking) { } else { StateBuff stateBuff = stateMachine.StateBuff; // Skip Animation if (stateBuff == StateBuff.Skip || stateBuff == StateBuff.Next) { if (state == RunAnimateState.Instance) { CompleteAnimate(); } } UpdateInput(); } }
protected override void OnMouseScrollWheelZoomOut() { if (!isConsoleShow) { ConsoleShow(); return; } BaseState state = stateMachine.CurrentState; StateBuff buff = stateMachine.StateBuff; if (buff == StateBuff.Normal) { if (state == RunAnimateState.Instance) { CompleteAnimate(); } else if (state == RunWaitState.Instance) { stateMachine.TransferStateTo(RunScriptState.Instance); } } else if (buff == StateBuff.Auto) { if (state == RunAnimateState.Instance) { CompleteAnimate(); } } }
protected override void OnMouseScrollWheelZoomIn() { BaseState state = stateMachine.CurrentState; StateBuff buff = stateMachine.StateBuff; Debug.Log("StageRender OnMouseScrollWheelZoomIn. state :" + state.StateName + " buff :" + buff.ToString()); if (buff == StateBuff.Normal) { if (state == RunAnimateState.Instance || state == RunWaitState.Instance || state == ChoiceWaitState.Instance) { Debug.Log("OnMouseScrollWheelZoomIn OnOtherShow(backlogRenderManager);"); OnOtherShow(backlogRenderManager); } } else if (buff == StateBuff.Auto) { if (state == RunAnimateState.Instance || state == RunWaitState.Instance || state == ChoiceWaitState.Instance) { stateMachine.SetStateBuff(StateBuff.Normal); OnOtherShow(backlogRenderManager); } } else if (buff == StateBuff.Skip) { if (state == RunAnimateState.Instance || state == RunWaitState.Instance || state == ChoiceWaitState.Instance) { stateMachine.SetStateBuff(StateBuff.Normal); OnOtherShow(backlogRenderManager); } } }
void ReviveActor(FightActor actor, int heal) { var cell = TargetedCell; if (!Fight.IsCellFree(cell)) { cell = Map.GetRandomAdjacentFreeCell(TargetedPoint, true); } actor.Revive(heal, Caster); actor.SummoningEffect = this; actor.Position.Cell = cell; actor.BuffRemoved += OnBuffRemoved; if (Spell.Id == (int)SpellIdEnum.LAISSE_SPIRITUELLE_420) { var actorBuffId = actor.PopNextBuffId(); var addStateHandler = new AddState(new EffectDice(EffectsEnum.Effect_AddState, (short)SpellStatesEnum.ZOMBI_74, 0, 0), actor, null, actor.Cell, false); var actorBuff = new StateBuff(actorBuffId, actor, Caster, addStateHandler, Spell, FightDispellableEnum.DISPELLABLE_BY_DEATH, SpellManager.Instance.GetSpellState((uint)SpellStatesEnum.ZOMBI_74)) { Duration = -1000 }; actor.AddBuff(actorBuff, true); } ActionsHandler.SendGameActionFightReviveMessage(Fight.Clients, Caster, actor); ContextHandler.SendGameFightTurnListMessage(Fight.Clients, Fight); }
public StateBuff AddStateBuff(Fighter target, SpellStateRecord stateRecord, FightDispellableEnum dispelable) { int id = target.BuffIdProvider.Pop(); StateBuff buff = new StateBuff(id, target, Source, this.SpellLevel, Effect, this.SpellId, Critical, dispelable, stateRecord); target.AddAndApplyBuff(buff); return(buff); }
public static void AddState(Fighter fighter, SpellLevelRecord level, ExtendedSpellEffect effect, List <Fighter> affecteds, short castercellid) { foreach (var target in affecteds) { StateBuff buff = new StateBuff((uint)target.BuffIdProvider.Pop(), (short)effect.BaseEffect.Value, effect.BaseEffect.Duration, fighter.ContextualId, (short)level.SpellId, effect.BaseEffect.Delay); target.AddBuff(buff); } }
public StateBuff AddStateBuff(FightActor target, bool dispelable, SpellState state) { int id = target.PopNextBuffId(); StateBuff stateBuff = new StateBuff(id, target, this.Caster, this.Dice, this.Spell, dispelable, state); target.AddAndApplyBuff(stateBuff, true); return(stateBuff); }
public static void AddState(Fighter fighter, SpellLevelRecord level, ExtendedSpellEffect effect, List<Fighter> affecteds, short castercellid) { foreach (var target in affecteds) { StateBuff buff = new StateBuff((uint)target.BuffIdProvider.Pop(), (short)effect.BaseEffect.Value, effect.BaseEffect.Duration, fighter.ContextualId, (short)level.SpellId, effect.BaseEffect.Delay); target.AddBuff(buff); } }
protected Buff AddStateBuffDirectly(FightActor target, bool bypassMaxStack, SpellState state, FightActor triggerer = null) { var id = target.PopNextBuffId(); var buff = new StateBuff(id, target, Caster, this, Spell, DefaultDispellableStatus, state, triggerer: triggerer); target.AddBuff(buff, bypassMaxStack); return(buff); }
//public static Vector3 CalcEularAngles(ScriptableData.CallData callData) //{ // if (null == callData || callData.GetId() != "eular") // return Vector3.zero; // int num = callData.GetParamNum(); // if (3 == num) { // float x = float.Parse(callData.GetParamId(0)); // float y = float.Parse(callData.GetParamId(1)); // float z = float.Parse(callData.GetParamId(2)); // try { // return Quaternion.Euler(x, y, z).eulerAngles; // } catch { // return new Vector3(x, y, z) * 59.29578f; // } // } else { // return Vector3.zero; // } //} internal static StateBuff CalcStateBuff(ScriptableData.CallData stCall) { StateBuff stateBuff = new StateBuff(); stateBuff.m_State = CaclStateFromStr(stCall.GetParamId(0)); for (int i = 1; i < stCall.GetParamNum(); i++) { int buffId = int.Parse(stCall.GetParamId(i)); stateBuff.m_Buffs.Add(buffId); } return(stateBuff); }
protected override void Load(FunctionData funcData) { CallData callData = funcData.Call; if (null != callData) { Load(callData); for (int i = 0; i < funcData.Statements.Count; ++i) { CallData stCall = funcData.Statements[i] as ScriptableData.CallData; if (null != stCall) { string id = stCall.GetId(); if (id == "statebuff") { StateBuff stateBuff = ScriptableDataUtility.CalcStateBuff(stCall); m_StateImpacts[stateBuff.m_State] = stateBuff; } if (id == "box") { int num = stCall.GetParamNum(); if (num >= 2) { m_Offset = ScriptableDataUtility.CalcVector3(stCall.GetParam(0) as ScriptableData.CallData); m_Size = ScriptableDataUtility.CalcVector3(stCall.GetParam(0) as ScriptableData.CallData); m_Rotation = Quaternion.identity; } } if (id == "line") { int num = stCall.GetParamNum(); if (num >= 3) { Vector3 startPos = ScriptableDataUtility.CalcVector3(stCall.GetParam(0) as ScriptableData.CallData); Vector3 endPos = ScriptableDataUtility.CalcVector3(stCall.GetParam(1) as ScriptableData.CallData); float radius = float.Parse(stCall.GetParamId(2)); m_Offset = (startPos + endPos) / 2; m_Size = new Vector3(Vector3.Distance(startPos, endPos), radius, radius); m_Rotation = Quaternion.LookRotation(Vector3.Cross((endPos - startPos), Vector3.up)); } } } } } }
protected override void OnMouseRightDown() { if (isConfirmShow) { OnConfirmNOHide(); } else if (isWorking) { BaseState state = stateMachine.CurrentState; StateBuff buff = stateMachine.StateBuff; if (buff == StateBuff.Normal) { if (state == RunWaitState.Instance) { if (isConsoleShow) { ConsoleHide(); } else { ConsoleShow(); } } else if (state == ChoiceWaitState.Instance) { if (isConsoleShow) { ConsoleHide(); } else { ConsoleShow(); } } } else if (buff == StateBuff.Auto) { stateMachine.SetStateBuff(StateBuff.Normal); } else if (buff == StateBuff.Skip) { stateMachine.SetStateBuff(StateBuff.Normal); } } }
protected override void OnUpdateStageContext() { if (paraList.Count != 0) { throw new System.Exception("ImageSmallFigureImageClearNode"); } StateBuff stateBuff = PachiGrimoire.I.StateMachine.StateBuff; if (stateBuff == StateBuff.Next) { StageRenderManager.I.SmallFigureImageClear(false); } else { StageRenderManager.I.SmallFigureImageClear(); } }
protected override void OnUpdateStageContext() { if (paraList.Count != 0) { throw new System.Exception("MusicVoicePlayNode"); } StateBuff stateBuff = PachiGrimoire.I.StateMachine.StateBuff; if (stateBuff == StateBuff.Next) { PachiGrimoire.I.MusicManager.VoiceStop(false); } else { PachiGrimoire.I.MusicManager.VoiceStop(); } }
protected override void OnUpdateStageContext() { if (paraList.Count != 1) { throw new System.Exception("ImageSmallFigureImageChangeNode"); } string index = paraList[0]; StateBuff stateBuff = PachiGrimoire.I.StateMachine.StateBuff; if (stateBuff == StateBuff.Next) { StageRenderManager.I.SmallFigureImageChange(index, false); } else { StageRenderManager.I.SmallFigureImageChange(index); } }
protected override void OnUpdateStageContext() { if (paraList.Count != 1) { throw new System.Exception("MusicBGMPlayNode"); } string bgmIndex = paraList[0]; // "SC_ScriptName" AudioClip bgmClip = PachiGrimoire.I.ResourceManager.Get <AudioClip>(bgmIndex); StateBuff stateBuff = PachiGrimoire.I.StateMachine.StateBuff; if (stateBuff == StateBuff.Next) { PachiGrimoire.I.MusicManager.BGMPlay(bgmClip, bgmIndex, false); } else { PachiGrimoire.I.MusicManager.BGMPlay(bgmClip, bgmIndex); } }
protected override void OnUpdateStageContext() { if (paraList.Count != 4 && paraList.Count != 6) { throw new System.Exception("ImageFigureImageAddNode"); } string uiKey = paraList[0]; string index = paraList[1]; float pos_x = float.Parse(paraList[2]); float pos_y = float.Parse(paraList[3]); float scale_x; float scale_y; StateBuff stateBuff = PachiGrimoire.I.StateMachine.StateBuff; if (stateBuff == StateBuff.Next) { if (paraList.Count == 4) { StageRenderManager.I.FigureImageAdd(uiKey, index, pos_x, pos_y, 1f, 1f, false); } else if (paraList.Count == 6) { scale_x = float.Parse(paraList[4]); scale_y = float.Parse(paraList[5]); StageRenderManager.I.FigureImageAdd(uiKey, index, pos_x, pos_y, scale_x, scale_y, false); } } else { if (paraList.Count == 4) { StageRenderManager.I.FigureImageAdd(uiKey, index, pos_x, pos_y); } else if (paraList.Count == 6) { scale_x = float.Parse(paraList[4]); scale_y = float.Parse(paraList[5]); StageRenderManager.I.FigureImageAdd(uiKey, index, pos_x, pos_y, scale_x, scale_y); } } }
protected override void OnUpdateStageContext() { if (paraList.Count != 2) { throw new System.Exception("MusicVoicePlayNode"); } string characterName = paraList[0]; // "SC_ScriptName" string voiceIndex = paraList[1]; AudioClip clip = PachiGrimoire.I.ResourceManager.Get <AudioClip>(voiceIndex); StateBuff stateBuff = PachiGrimoire.I.StateMachine.StateBuff; if (stateBuff == StateBuff.Next) { PachiGrimoire.I.MusicManager.VoicePlay(characterName, clip, voiceIndex, false); } else { PachiGrimoire.I.MusicManager.VoicePlay(characterName, clip, voiceIndex); } }
public void LoadStoryRecord(string currentStateName, string lastStateName, StateBuff stateBuff) { StateBuff = stateBuff; for (int i = 0; i < stateArray.Length; i++) { BaseState state = stateArray[i]; if (state.StateName.Equals(currentStateName)) { CurrentState = state; break; } } for (int i = 0; i < stateArray.Length; i++) { BaseState state = stateArray[i]; if (state.StateName.Equals(lastStateName)) { LastState = state; break; } } }
protected override void Load(FunctionData funcData) { CallData callData = funcData.Call; if (null != callData) { Load(callData); for (int i = 0; i < funcData.Statements.Count; ++i) { if (funcData.Statements[i] is ScriptableData.CallData stCall) { string id = stCall.GetId(); if (id == "statebuff") { StateBuff stateBuff = ScriptableDataUtility.CalcStateBuff(stCall); m_StateImpacts[stateBuff.m_State] = stateBuff; } } } } }
protected override void OnUpdateStageContext() { if (paraList.Count != 2 && paraList.Count != 1) { throw new System.Exception("TextChangeNode"); } // 文本Index,角色名(可选) string dialogContextIndex = paraList[0]; string characterName; StateBuff stateBuff = PachiGrimoire.I.StateMachine.StateBuff; if (stateBuff == StateBuff.Next) { if (paraList.Count == 1) { StageRenderManager.I.TextChange(dialogContextIndex, null, false); } else if (paraList.Count == 2) { characterName = paraList[1]; StageRenderManager.I.TextChange(dialogContextIndex, characterName, false); } } else { if (paraList.Count == 1) { StageRenderManager.I.TextChange(dialogContextIndex); } else if (paraList.Count == 2) { characterName = paraList[1]; StageRenderManager.I.TextChange(dialogContextIndex, characterName); } } }
public StateMachineManager(BaseState currentState) { this.CurrentState = currentState; StateBuff = StateBuff.Normal; }
public void SetStateBuff(StateBuff stateBuff) { StateBuff = stateBuff; Messenger.Broadcast("SetStateBuff", StateBuff); }
public DisableStateBuff(int id, FightActor target, FightActor caster, SpellEffectHandler effect, Spell spell, FightDispellableEnum dispelable, StateBuff stateBuff, FightActor triggerer = null) : base(id, target, caster, effect, spell, false, dispelable, triggerer) { StateBuff = stateBuff; }
public void FinalizeStory() { StateBuff = StateBuff.Normal; }
private void Update() { #region Test if (Input.GetKeyDown(constData.KeyConfirm)) { StartGame(); } else if (Input.GetKeyDown(KeyCode.T)) { StartGameTest(); } #endregion #region State BaseState state = stateMachine.CurrentState; if (state == RunScriptState.Instance) // RunScript State { bool success = scriptManager.NextSentence(); if (success == false) { Debug.LogWarning("脚本执行结束"); if (stageRenderManager.IsShow == true) { stageRenderManager.OnHide(); FinalizeGame(); } } } else if (state == RunWaitState.Instance) // RunWait State { StateBuff stateBuff = stateMachine.StateBuff; if (stateBuff == StateBuff.Normal) { // Pass } else if (stateBuff == StateBuff.Auto) // Auto Buff { if (isFirstInAutoBuff == false) { isFirstInAutoBuff = true; float autoMessageSpeed = ConfigManager.Config.AutoMessageSpeed; float highestTime = constData.AutoMessageSpeedHighest; float lowestTime = constData.AutoMessageSpeedLowest; autoWaitTime = (highestTime - lowestTime) * autoMessageSpeed + lowestTime; autoStartTime = Time.time; } if (Time.time - autoStartTime >= autoWaitTime) { stateMachine.TransferStateTo(RunScriptState.Instance); isFirstInAutoBuff = false; } } else if (stateBuff == StateBuff.Skip) // Skip Buff { if (configManager.Config.IsReadSkipOrAllSkipNot) { if (PastScriptManager.HasRead(ScriptManager.ScriptPointerScriptName, scriptManager.ScriptPointerLineNumber)) { stateMachine.TransferStateTo(RunScriptState.Instance); } else { stateMachine.SetStateBuff(StateBuff.Normal); } } else { stateMachine.TransferStateTo(RunScriptState.Instance); } } else if (stateBuff == StateBuff.Next) // Next Buff { stateMachine.TransferStateTo(RunScriptState.Instance); } } #endregion }