public void InitViewPriorityList() { ContTurns.Get().subAllPriorityChange.Subscribe(cbUpdateHeadshots); //Initially set up the headshots cbUpdateHeadshots(null); }
public override void OnEnter() { //Do any death-related effects chrOwner.bDead = true; //Fix our position in the priority queue (we should now be after all living characters) ContTurns.Get().FixSortedPriority(chrOwner); //Once we're done swapping, this dead character should be at the end of the living section of the list //so reduce the size of the living section of the list by one so they're no longer included ContTurns.Get().nLiveCharacters--; //Debug.Log("nLive Characters is now " + ContTurns.Get().nLiveCharacters + " since " + chrOwner.sName + " just died"); //After fixing priority ordering (pushing this character to the back) //TODO do a check for if the game should be over /* * if(chrNextToBlock == null) { * Debug.Log("Game should end"); * Player.subAllPlayerLost.NotifyObs(chrOwner.plyrOwner); * ContTime.Get().Pause(); * } else { * chrOwner.plyrOwner.SetDefaultBlocker(); * } * */ Debug.Log("Remember to dispell soul effects on dying characters"); chrOwner.subDeath.NotifyObs(chrOwner); Chr.subAllDeath.NotifyObs(chrOwner); }
public IEnumerator SetupMatch() { while (NetworkMatchSetup.HasAllMatchSetupInfo() == false) { //Spin until we have all the match setup info that we need to start the match yield return(null); } while (NetworkMatchSender.Get() == null) { //Spin until the needed networking objects have been spawned and given a chance to initialize // - in particular, the NetworkMatchSender needs to be ready in case we need to immediately send inputs // as part of initializing the match (like for loading a log file) yield return(null); } Debug.Log("Starting match initializations since we have enough information"); ContRandomization.Get().InitGenerator(NetworkMatchSetup.GetRandomizationSeed()); Debug.Log("Finished initializing the randomizer"); InitPlayers(nPlayers); Debug.Log("Finished initializing players"); //Initialize characters InitAllChrs(); Debug.Log("After InitAllChrs"); //Assign local input controllers for each player AssignAllLocalInputControllers(); Debug.Log("After assigning local input controllers"); ContManaDistributer.Get().InitializeRandomReserves(); Debug.Log("After initializing mana reserves"); InitAllChrPositions(); Debug.Log("After initializing positions"); //ContPositions.Get().PrintAllPositions(); ContTurns.Get().InitializePriorities(); Debug.Log("After InitializePriorities"); //Check if the LogManager wants to load in any starting inputs LogManager.Get().LoadStartingInputs(); Debug.Log("After LoadStartingInputs"); LogManager.Get().InitMatchLog(); Debug.Log("Finished initializing the log file"); }
protected override void AttemptFillRandomly() { chrActing = ContTurns.Get().GetNextActingChr(); int nMaxSelectionAttempts = 5; int nCurSelectionAttempt = 0; //We'll attempt a few selections to see if we can find something legal while (nCurSelectionAttempt < nMaxSelectionAttempts) { nCurSelectionAttempt++; //Select a random skill we have that's off cooldown skillslotSelected = chrActing.arSkillSlots[Random.Range(0, Chr.nEquippedCharacterSkills)]; lstSelections = new List <object>(); //If the skill can't be activated for whatever reason (like being a passive), then skip to the next attempt if (skillslotSelected.chrOwner.curStateReadiness.CanSelectSkill(skillslotSelected.skill) == false) { continue; } //If the skill is on cooldown, then we'll skip to the next attempt if (skillslotSelected.IsOffCooldown() == false) { continue; } //For each target we have to fill out, get a random selectable for its targetting type bool bFailedSelection = false; for (int i = 0; i < skillslotSelected.skill.lstTargets.Count; i++) { //Debug.LogFormat("Skill {0} is asking for selections for its {1}th target, {2}", skillSelected, i, skillSelected.lstTargets[i]); if (skillSelected.lstTargets[i].HasAValidSelectable(this) == false) { bFailedSelection = true; break; } //If there's at least something selectable, then pick one of them randomly lstSelections.Add(skillSelected.lstTargets[i].GetRandomValidSelectable(this)); } if (bFailedSelection) { //If we failed finding a selection for some skill, then continue on in the loop to find a different skill selection //Before we move on to the next selection attempt, clear out any reserved mana amounts chrActing.plyrOwner.manapool.ResetReservedMana(); continue; } //If we reached this far without failing a selection, then we should have a fully filled out random selection so we can return Debug.AssertFormat(CanLegallyExecute(), "{0} is an invalid random selection", ToString()); return; } //If we tried many times and couldn't get a valid selection, then we'll just reset the default input ResetToDefaultInput(); }
public override void StartSelection() { base.StartSelection(); Debug.Log(LibDebug.AddColor("Starting Input Selection for " + ContTurns.Get().chrNextReady, LibDebug.Col.RED)); ContTurns.Get().chrNextReady.subBecomesActiveForHumans.NotifyObs(); subAllHumanStartSelection.NotifyObs(plyrOwner); }
public override void EndSelection() { base.EndSelection(); Debug.Log(LibDebug.AddColor("Finished Input Selection for " + ContTurns.Get().chrNextReady, LibDebug.Col.RED)); ContTurns.Get().chrNextReady.subEndsActiveForHumans.NotifyObs(); subAllHumanEndSelection.NotifyObs(plyrOwner); }
public ManaDate GetPreviousManaDate() { int nPrevDay = (ContTurns.Get().nTurnNumber - 2) % NDAYS; if (nPrevDay < 0) { nPrevDay += NDAYS; } return(arManaDates[nPrevDay]); }
//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 override void ExecuteEffect() { //Advance the turn count to the next turn number since this is the first phase of a turn ContTurns.Get().NextTurn(); RechargeChars(); sLabel = "Reducing Fatigue/ChannelTimes"; fDelay = ContTime.fDelayTurnSkill; ViewAnnouncement.Get().InitAnnouncement(2.0f, "TURN " + ContTurns.Get().nTurnNumber); }
//Fetch the current selection information passed to us from the Master public virtual InputSkillSelection GetUsedSelections() { InputSkillSelection selections = (InputSkillSelection)NetworkMatchReceiver.Get().GetCurMatchInput(); //You can only get legitimate selections for this skill if the selection passed is referring to // this skill Debug.Assert(selections != null, "ERROR - Master has passed no selectionsFromMaster at this point"); Debug.Assert(ContTurns.Get().GetNextActingChr() == skill.chrOwner, "ERROR - The acting character isn't the owner of this skill"); Debug.Assert(selections.skillslotSelected.skill == skill, "ERROR - The selected skill from the player does not match this skill"); return selections; }
public override void Start() { if (bStarted == false) { bStarted = true; Chr.subAllStatusChange.Subscribe(cbChrSelectionChange); ContTurns.Get().subAllPriorityChange.Subscribe(cbChrPriorityOrderChange); Display(); base.Start(); } }
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(); }
// Apply this amount of fatigue to the character public void ChangeFatigue(int _nChange, bool bBeginningTurn = false) { if (_nChange + nFatigue < 0) { nFatigue = 0; } else { nFatigue += _nChange; } subFatigueChange.NotifyObs(this); subAllFatigueChange.NotifyObs(this); //TODO:: Probably delete this bBeginningTurn flag once I get a nice solution for priority handling if (!bBeginningTurn) { //Then this is a stun or an skills used ContTurns.Get().FixSortedPriority(this); //So make sure we're in the right place in the priority list } }
public ManaDate GetCurrentManaDate() { int nCurDay = (ContTurns.Get().nTurnNumber - 1) % NDAYS; return(arManaDates[nCurDay]); }
public void Start() { ContTurns.Get().subTurnChange.Subscribe(cbOnDateChange); }
public IEnumerator ProcessStacks() { while (true) { while (stackExec.Count == 0) { //If we don't have any executables to process, then we have to unpack clauses until we do have an executable if (stackClause.Count > 0) { //If we have a clause on our stack, then unpack that to hopefully add an executable to the stack if (bDEBUGENGINE) { Debug.Log("No Executables, so unpack a Clause"); } ResolveClause(); } else { //If we have no clauses on our stack, then our stack is completely empty, so we can push // a new executable for the next phase of the turn if (bDEBUGENGINE) { Debug.Log("No Clauses or Executables so move to the next part of the turn"); } ContTurns.Get().FinishedTurnPhase(); } } //If we've gotten this far, then we know we have an executable to examine //Check if the executable on top of our stack has dealt with its pre-triggers/replacements yet if (stackExec.Peek().bPreTriggered) { //If we've already dealt with all its pretriggers/replacements, then we're ready to actually evaluate and we can // exit our loop break; } else { //Debug.Log("Performing Replacement effects and Pre-Triggers"); //Pop off the top element Executable top = stackExec.Pop(); //Check for any replacement effects //Initially, we reset the cycle-checking flags for each registered replacement effect Replacement.ResetReplacedFlags(); //Resolve any full replacement effects (so we settle on a single type of executable) top = ResolveFullReplacements(top); //Now we modify that executable as much as necessary top = ResolveReplacements(top); //Push the modified executable back onto the stack at the top stackExec.Push(top); //Now we can push all of the pre-triggers onto the stack top.GetPreTrigger().NotifyObs(null, top); //Set our flag so that we don't pre-trigger this effect again top.bPreTriggered = true; //Now we can continue our loop to process whatever executable is now at the top of the stack } } //If we've gotten this far, then we know we have an executable at the top of our stack and // we are ready to process it yield return(ResolveExec()); }
public void ResetToRestSelection() { chrActing = ContTurns.Get().GetNextActingChr(); skillslotSelected = chrActing.skillRest.skillslot; lstSelections = new List <object>(); }
public void cbRestButtonStopHover(Object target, params object[] args) { StopDisplaySkill(ContTurns.Get().GetNextActingChr().skillRest); }
public bool ButtonVisible() { //Needs to have a character that's acting next this turn, and is selected (and maybe should be in the skill selection phase) return(ContTurns.Get().GetNextActingChr() != null && ContTurns.Get().GetNextActingChr().stateSelect == Chr.STATESELECT.SELECTED); }