public override void OnEnter() { //First, increase the fatigue value of the character ContSkillEngine.Get().AddExec(new ExecChangeFatigue(null, chrOwner, nStunAmount, false)); //Then, add a replacement effect to cancel out any further stuns that we would take repStun = new Replacement() { //The list of replacement effects we'll include ourselves in lstExecReplacements = ExecStun.lstAllFullReplacements, //Note that the parameter type is the generic Executable // - should cast to the proper type if further checking is required shouldReplace = (Executable exec) => { Debug.Assert(typeof(ExecStun) == exec.GetType()); //replace only if the stunned character will be the character this effect is on return(((ExecStun)exec).chrTarget == this.chrOwner); }, //Just replace the executable with a completely new null executable execReplace = (Executable exec) => new ExecNull(exec.chrSource) }; //Register this replacement effect so that it will take effect Replacement.Register(repStun); //Let observers know to start paying attention to the fatigue value now // and to clear out any channeling time (if applicable) chrOwner.subFatigueChange.NotifyObs(); chrOwner.subChannelTimeChange.NotifyObs(); }
} //Specifically when the soul effect reaches the end of its duration public void OnApply(SoulContainer _soulContainer) { //Save a reference to the soulContainer we're in soulContainer = _soulContainer; //If we have a duration, then set the current duration to the max if (bDuration == true) { nCurDuration = pnMaxDuration.Get(); } if (lstTriggers != null) //Then we have some triggers to subscribe //Each triggeredeffect we have should subscribe to the trigger it needs { foreach (TriggerEffect trig in lstTriggers) { if (ContSkillEngine.bDEBUGENGINE) { Debug.Log("*** ADDING TRIGGER SUBSCRIPTION ***"); } //Let our observer manage our subscription to the trigger observer.Observe(trig.sub, trig.cb); } } foreach (Replacement rep in lstReplacements) { //For each replacement effect this soul effect has, register it so it'll take effect Replacement.Register(rep); } observer.Observe(chrSource.subDeath, cbOnChrSourceDeath); ApplicationEffect(); if (ContSkillEngine.bDEBUGENGINE) { Debug.Log(sName + " has been applied"); } }