public void cbOnEndTurn(Object target, object[] args) { ContSkillEngine.Get().AddExec(new ExecLoseLife(chrSource, chrTarget, nLifeLoss) { sLabel = "Get me a cleanser booster!" }); }
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(); }
public override void ChangeChanneltime(int _nChange) { if (chrOwner.bDead) { Debug.Log("Tried to change channeltime, but " + chrOwner.sName + " is dead"); return; } //We can actually reduce the channel time if we're in this state if (_nChange + nChannelTime < 0) { nChannelTime = 0; } else { nChannelTime += _nChange; } Debug.Log("Channel time changed to " + nChannelTime); //If, for any reason, we've now been put to 0 channeltime, then our channel completes // and we transition to the fatigued state if (nChannelTime == 0) { Debug.Log("Naturally completed the channel, so pushing ExecCompleteChannel"); ContSkillEngine.Get().AddExec(new ExecCompleteChannel(null, chrOwner)); } }
public void ApplyBuff(Chr chrAlly) { //Make sure we are buffing an ally and not ourselves if (chrAlly == this.chrTarget) { return; } //Don't target dead characters if (chrAlly.bDead) { Debug.LogError("Attempting to buff a dead character - shouldn't have been supplied as an active character"); return; } //So we're sure we're buffing a valid character at this point ContSkillEngine.Get().AddExec(new ExecApplySoulChr(chrSource, chrAlly, new SoulChangePower(chrSource, chrAlly, skillSource, nPowerGain, 1) { //Set up the hidden soul effect that's buffing the ally's power bRemoveOnChrSourceDeath = true }) { //Set up the properties of the soul application executable sLabel = chrAlly.sName + " is inspired by " + this.chrSource.sName }); }
public void GainLife() { ContSkillEngine.Get().AddExec(new ExecHeal(chrTarget, chrTarget, heal) { arSoundEffects = new SoundEffect[] { new SoundEffect("PitBeast/sndSadism", 1.067f) }, sLabel = "ooh it hurts so good" }); }
public void OnMouseDown() { //Let the skill engine know that it can start the match ContSkillEngine.Get().StartMatchLoop(); //disable ourselves since we're not needed anymore (and since we don't want to allow double-clicking) this.gameObject.SetActive(false); }
//Only want the damage to go off if the soul effect expires naturally public override void ExpirationEffect() { ContSkillEngine.Get().AddExec(new ExecDealDamage(chrSource, chrTarget, dmg) { arSoundEffects = new SoundEffect[] { new SoundEffect("Saiko/sndStickyBombDetonate", 3.1f) }, sLabel = "Ai-same-CRIER, aibu-save-LIAR" }); }
public void cbOnEndTurn(Object target, object[] args) { Debug.Log("We have been triggered at the end of turn to add a burn damage exec"); ContSkillEngine.Get().AddExec(new ExecDealDamage(this.chrSource, this.chrTarget, new Damage(dmg)) { sLabel = "Taking damage from Burn effect" }); }
public void GiveManaToAllPlayers() { //Give the mana to each player as specified by the ContManaDistributer for (int i = 0; i < Match.Get().nPlayers; i++) { Player plyrToGive = Match.Get().arPlayers[i]; ContSkillEngine.Get().AddExec(new ExecChangeMana(null, plyrToGive, ContManaDistributer.Get().GetCurrentTurnStartManaForPlayer(plyrToGive))); } }
public override void Recharge() { if (chrOwner.bDead) { Debug.Log("Tried to recharge, but " + chrOwner.sName + " is dead"); return; } //If we're channeling, instead of reducing fatigue, we only reduce the channel time ContSkillEngine.Get().AddExec(new ExecChangeChannel(null, chrOwner, -1)); }
//All that chooseskills needs to do is store the selection information for the // chosen skill so that ContTurns->FinishedTurnPhase can post this information to the master public override void ExecuteEffect() { //Get the character that is currently set to be acting next Chr chrActing = ContTurns.Get().GetNextActingChr(); //Fill the current matchinputtofill with a new blank skill selection request ContSkillEngine.Get().matchinputToFillOut = new InputSkillSelection(chrActing.plyrOwner.id, chrActing, null); //Note that since matchinputToFillOut is 'raised' by being non-null, then we'll stop evaluating executables until we // receive completed input from the active player }
public void SetTurnState(STATETURN _curStateTurn) { OnLeavingState(curStateTurn); curStateTurn = _curStateTurn; switch (curStateTurn) { case STATETURN.RECHARGE: ContSkillEngine.Get().AddExec(new ExecTurnRecharge(_chrSource: null)); break; case STATETURN.READY: ContSkillEngine.Get().AddExec(new ExecTurnReady(_chrSource: null)); break; case STATETURN.REDUCECOOLDOWNS: ContSkillEngine.Get().AddExec(new ExecTurnReduceCooldowns(_chrSource: null)); break; case STATETURN.GIVEMANA: ContSkillEngine.Get().AddExec(new ExecTurnGiveMana(_chrSource: null)); break; case STATETURN.TURNSTART: ContSkillEngine.Get().AddExec(new ExecTurnStartTurn(_chrSource: null)); break; case STATETURN.CHOOSESKILL: ContSkillEngine.Get().AddExec(new ExecTurnChooseSkills(_chrSource: null)); break; case STATETURN.TURNEND: ContSkillEngine.Get().AddExec(new ExecTurnEndTurn(_chrSource: null)); break; } }
public virtual IEnumerator PlayAnimations() { if (fDelay == 0f) { yield break; } //By default, we'll just start a timer with an appropriate label, then wait for it to finish ContSkillEngine.Get().SpawnTimer(fDelay, sLabel); yield return(new WaitForSeconds(fDelay)); }
public override void ClauseEffect(InputSkillSelection selections) { //Check if the character has any fatigue already if (skill.chrOwner.nFatigue == 0) { //If not, then give them the rest fatigue ContSkillEngine.Get().AddExec(new ExecChangeFatigue(skill.chrOwner, skill.chrOwner, nRestFatigue, false) { sLabel = "Resting" }); } skill.chrOwner.SetStateReadiness(new StateFatigued(skill.chrOwner)); }
//This is called if we've cleared out processing the current part of the turn, // so we should send a signal to the master letting them know that this player is done that // phase of the turn. public void FinishedTurnPhase() { if (ContSkillEngine.Get().AreStacksEmpty() == false) { Debug.LogError("There's still more to evaluate on the stacks, so we can't finish the turn yet"); return; } if (ContSkillEngine.bDEBUGENGINE) { Debug.Log("Finished the turn phase: " + curStateTurn); } //Move to the next phase of the turn SetTurnState(GetNextPhase(curStateTurn)); }
public void RechargeSkills() { //Only bother recharging the active skills since those will be the only ones that can be on cooldown for (int i = 0; i < Chr.nEquippedCharacterSkills; i++) { //Only reduce the cooldown if it is not currently off cooldown if (arSkillSlots[i].nCooldown > 0) { ContSkillEngine.Get().AddExec(new ExecChangeCooldown(null, arSkillSlots[i], -1) { fDelay = ContTime.fDelayMinorSkill }); } } }
public void FinishSelections() { //Only allow manual selections when the local player is human Debug.Assert(ContTurns.Get().GetNextActingChr().plyrOwner.inputController.GetInputType() == LocalInputType.InputType.HUMAN, "Error - can only submit skills for locally-owned >human<'s characters"); Debug.Assert(NetworkMatchSetup.IsLocallyOwned(ContTurns.Get().GetNextActingChr().plyrOwner.id), "Error - can only submit skills for >locally-owned< human's characters"); //By this point, we have built up our local selectionsInProgress skill selection into a valid selection of targets, // so let's pass a reference into the Skill Engine's matchinputToFillOut so it can be submitted ContSkillEngine.Get().matchinputToFillOut = selectionsInProgress; NetworkMatchSender.Get().SendNextInput(ContSkillEngine.Get().matchinputToFillOut); //Clean up the selection process (clears out the stored selections structure, sends notifications, etc.) ExitSelectionsProcess(); }
public override void Ready() { if (chrOwner.bDead) { Debug.Log("Tried to Ready, but " + chrOwner.sName + " is dead"); return; } if (chrOwner.nFatigue == 0) { //Then transition to the ready state //Leave the source as null since it's just the game rules causing the readying ContSkillEngine.Get().AddExec(new ExecReadyChar(null, chrOwner) { fDelay = ContTime.fDelayStandard, sLabel = chrOwner.sName + " is Readying" }); } }
public void SubmitNextSkill() { Debug.Assert(ContSkillEngine.Get().matchinputToFillOut != null, "AI input was asked to submit an input, but we're not locally waiting on any input"); Debug.AssertFormat(ContSkillEngine.Get().matchinputToFillOut.iPlayerActing == plyrOwner.id, "Scripted input was asked to submit an input for player {0}, but this controller is for player {1}", ContSkillEngine.Get().matchinputToFillOut.iPlayerActing, plyrOwner.id); //Just randomly select an input that would work for the pending match input ContSkillEngine.Get().matchinputToFillOut.FillRandomly(); //Double check that the input that we're planning to submit is actually valid if (ContSkillEngine.Get().matchinputToFillOut.CanLegallyExecute() == false) { Debug.LogErrorFormat("Warning - resetting input to default since an illegal input {0} was attempted", ContSkillEngine.Get().matchinputToFillOut); //If it wasn't legal, then reset it to some default failsafe that is guaranteed to be legal ContSkillEngine.Get().matchinputToFillOut.ResetToDefaultInput(); } //By this point, we have a valid input, so let's submit it NetworkMatchSender.Get().SendNextInput(ContSkillEngine.Get().matchinputToFillOut); }
public void SubmitNextSkill() { Debug.Assert(ContSkillEngine.Get().matchinputToFillOut != null, "Scripted input was asked to submit an input, but we're not locally waiting on any input"); Debug.AssertFormat(ContSkillEngine.Get().matchinputToFillOut.iPlayerActing == plyrOwner.id, "Scripted input was asked to submit an input for player {0}, but this script is for player {1}", ContSkillEngine.Get().matchinputToFillOut.iPlayerActing, plyrOwner.id); //If we already used all of the inputs in our script, then we should change our inputtype to something more flexible if (nInputIndex >= lstInputScript.Count) { Debug.LogFormat("Finished scripted input for Player {0} - switching to type {1}", plyrOwner, inputtypeToSwitchTo); plyrOwner.SetInputType(inputtypeToSwitchTo); plyrOwner.inputController.StartSelection(); return; } //If we still have inputs in our script, take the appropriate one ContSkillEngine.Get().matchinputToFillOut = lstInputScript[nInputIndex]; //Double check that the input that we're planning to submit is actually valid if (ContSkillEngine.Get().matchinputToFillOut.CanLegallyExecute() == false) { Debug.LogErrorFormat("Warning - resetting input to default since an illegal input {0} was attempted", ContSkillEngine.Get().matchinputToFillOut); //If it wasn't legal, then reset it to some default failsafe that is guaranteed to be legal ContSkillEngine.Get().matchinputToFillOut.ResetToDefaultInput(); } //Since we've grabbed this input, advance our index to be ready for the next requested input nInputIndex++; //By this point, we have a valid input, so let's submit it NetworkMatchSender.Get().SendNextInput(ContSkillEngine.Get().matchinputToFillOut); }
//Called at the beginning of turn to reduce fatigue public virtual void Recharge() { //By default, we just reduce fatigue by 1 (with the beginning of turn flag) ContSkillEngine.Get().AddExec(new ExecChangeFatigue(null, chrOwner, -1, true)); }
public void ChooseSkillToSelect(Skill _skillSelected) { // When we've clicked a skill, try to use that skill // There's a bunch of checks we have to do for this though first to ensure we should be selecting this skill // Check if we're already in the process of selecting for a skill if (selectionsInProgress != null) { Debug.Log("We are already in the process of selecting targets for a skill, so we can't start the selections process for another skill"); return; } if (ContSkillEngine.Get().matchinputToFillOut == null) { Debug.Log("Can't select a skill since we're not waiting on any input right now"); return; } //If the skill we've selected doesn't belong to the next acting character, then we can't proceed with selecting it if (ContSkillEngine.Get().matchinputToFillOut.iPlayerActing != _skillSelected.chrOwner.plyrOwner.id) { Debug.Log("Can't select skills for a character who isn't currently acting"); return; } // If this skill isn't owned by a locally-controlled client, then reject this selection if (_skillSelected.chrOwner.plyrOwner.inputController == null) { Debug.Log("We can't select skills for a character we don't locally control"); return; } // Check if it's actually got a LocalInputType that will allow us to select a skill // (i.e., if we have asked this locally-controlled client to select a skill for us if (_skillSelected.chrOwner.plyrOwner.inputController.CanProceedWithSkillSelection() == false) { Debug.Log("This character is owned by a local player, but selecting targets for a new skill is not available currently"); return; } if (((InputSkillSelection)ContSkillEngine.Get().matchinputToFillOut).chrActing != _skillSelected.chrOwner) { Debug.Log("Can't start selections for a character who's not expected to be acting now"); return; } // Check if it's on cooldown if (_skillSelected.skillslot.IsOffCooldown() == false) { Debug.Log("We can't use a skill that's on cooldown"); return; } if (!_skillSelected.chrOwner.curStateReadiness.CanSelectSkill(_skillSelected)) { Debug.Log("We can't use a skill right now cause the character's readiness state doesn't allow it"); //(like trying to use a second active) return; } //Initiallize our local selectionsInProgress to be choosing selections for the targets of the provided skill selectionsInProgress = new InputSkillSelection(_skillSelected.chrOwner.plyrOwner.id, _skillSelected.chrOwner, _skillSelected.skillslot); //Lock character selections (can unlock as needed depending on which targetting type we need to do) bCanSelectCharacters = false; //Set our character-highlighting state to just be idle SetState(new StateTargetIdle()); //Transition to the appropriate state for gettings the selections for the first required target (likely mana cost payment) EnterNextSelectionState(); }