Skip to content

Commit

Permalink
Merge branch 'dev/2.5.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
mayjak committed Jul 29, 2022
2 parents a9e3c77 + 25ccbd8 commit 8843cc9
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?xml version="1.0" encoding="utf-8"?><resources><string name="com.crashlytics.android.build_id" translatable="false">b76cf6ec-2c58-443f-a130-43c0a6f95235</string></resources>
<?xml version="1.0" encoding="utf-8"?><resources><string name="com.crashlytics.android.build_id" translatable="false">1db01ce8-707a-49e9-a6f0-685ae965291d</string></resources>
2 changes: 1 addition & 1 deletion unity/Assets/Resources/prod_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.5.6
2.5.7
2 changes: 1 addition & 1 deletion unity/Assets/Resources/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.5.6
2.5.7
15 changes: 10 additions & 5 deletions unity/Assets/Scripts/Quest/EventManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,22 @@ public void Init(Dictionary<string, string> data)
}

// Queue all events by trigger, optionally start
public void EventTriggerType(string type, bool trigger=true)
public bool EventTriggerType(string type, bool trigger=true)
{
bool queued = false;
foreach (KeyValuePair<string, Event> kv in events)
{
if (kv.Value.qEvent != null && kv.Value.qEvent.trigger.Equals(type))
{
QueueEvent(kv.Key, trigger);
queued |= QueueEvent(kv.Key, trigger);
}
}

return queued;
}

// Queue event, optionally trigger next event
public void QueueEvent(string name, bool trigger=true)
public bool QueueEvent(string name, bool trigger=true)
{
// Check if the event doesn't exists - quest fault
if (!events.ContainsKey(name))
Expand All @@ -130,12 +133,12 @@ public void QueueEvent(string name, bool trigger=true)
{
ValkyrieDebug.Log("Warning: Missing event called: " + name);
game.CurrentQuest.log.Add(new Quest.LogEntry("Warning: Missing event called: " + name, true));
return;
return false;
}
}

// Don't queue disabled events
if (events[name].Disabled()) return;
if (events[name].Disabled()) return false;

// Place this on top of the stack
eventStack.Push(events[name]);
Expand All @@ -145,6 +148,8 @@ public void QueueEvent(string name, bool trigger=true)
{
TriggerEvent();
}

return true;
}

// Trigger next event in stack
Expand Down
36 changes: 22 additions & 14 deletions unity/Assets/Scripts/Quest/RoundController.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using ValkyrieTools;
using System.Collections.Generic;
using Assets.Scripts.Content;
using UnityEngine;
using ValkyrieTools;

// This class controls the progression of activations and events
public class RoundController {

public class RoundController
{
// Latch activations finished incase more monsters come
bool activationsFinished = false;

Expand Down Expand Up @@ -81,7 +80,7 @@ virtual public void MonsterActivated()
}

// If there no heros left activate another monster
if(herosActivated)
if (herosActivated)
{
if (ActivateMonster())
{
Expand Down Expand Up @@ -139,6 +138,7 @@ virtual public bool ActivateMonster(Quest.Monster m)
{
md = game.cd.Get<MonsterData>(qm.derivedType);
}

// Determine if the monster has quest specific activations
customActivations = !qm.useMonsterTypeActivations;
}
Expand All @@ -154,10 +154,12 @@ virtual public bool ActivateMonster(Quest.Monster m)
{
// Find the activation in quest data
if (game.CurrentQuest.qd.components.ContainsKey("Activation" + s)
&& game.CurrentQuest.vars.Test((game.CurrentQuest.qd.components["Activation" + s] as QuestData.Activation).tests)
&& game.CurrentQuest.vars.Test(
(game.CurrentQuest.qd.components["Activation" + s] as QuestData.Activation).tests)
)
{
adList.Add(new QuestActivation(game.CurrentQuest.qd.components["Activation" + s] as QuestData.Activation));
adList.Add(new QuestActivation(
game.CurrentQuest.qd.components["Activation" + s] as QuestData.Activation));
}
// Otherwise look for the activation in content data
else if (game.cd.TryGet("MonsterActivation" + s, out ActivationData activationData))
Expand All @@ -166,7 +168,9 @@ virtual public bool ActivateMonster(Quest.Monster m)
}
else // Invalid activation
{
game.CurrentQuest.log.Add(new Quest.LogEntry("Warning: Unable to find activation: " + s + " for monster type: " + m.monsterData.sectionName, true));
game.CurrentQuest.log.Add(new Quest.LogEntry(
"Warning: Unable to find activation: " + s + " for monster type: " +
m.monsterData.sectionName, true));
}
}
}
Expand All @@ -182,6 +186,7 @@ virtual public bool ActivateMonster(Quest.Monster m)
adList.Add(kv.Value);
}
}

// Search for additional common activations
foreach (string s in md.activations)
{
Expand All @@ -191,7 +196,8 @@ virtual public bool ActivateMonster(Quest.Monster m)
}
else
{
ValkyrieDebug.Log("Warning: Unable to find activation: " + s + " for monster type: " + md.sectionName);
ValkyrieDebug.Log("Warning: Unable to find activation: " + s + " for monster type: " +
md.sectionName);
}
}
}
Expand Down Expand Up @@ -241,10 +247,11 @@ virtual public bool ActivateMonster(Quest.Monster m)
m.minionStarted = Random.Range(0, 2) == 0;

// If order specificed then use that instead
if(m.currentActivation.ad.masterFirst)
if (m.currentActivation.ad.masterFirst)
{
m.minionStarted = false;
}

if (m.currentActivation.ad.minionFirst)
{
m.minionStarted = true;
Expand Down Expand Up @@ -276,6 +283,7 @@ public virtual void EndRound()
game.CurrentQuest.vars.SetValue("#eliminatedcomplete", 1);
game.CurrentQuest.eManager.EventTriggerType("Eliminated", false);
}

if (game.CurrentQuest.vars.GetValue("#eliminated") > 0)
{
game.CurrentQuest.vars.SetValue("#eliminatedprev", 1);
Expand All @@ -288,7 +296,6 @@ public virtual void EndRound()
// Check if ready for new round
public virtual bool CheckNewRound()
{

Game game = Game.Get();

// Is there an active event?
Expand All @@ -308,6 +315,7 @@ public virtual bool CheckNewRound()
{
h.activated = false;
}

// Clear monster activations
foreach (Quest.Monster m in game.CurrentQuest.monsters)
{
Expand All @@ -334,4 +342,4 @@ public virtual bool CheckNewRound()
SaveManager.Save(0);
return true;
}
}
}
43 changes: 32 additions & 11 deletions unity/Assets/Scripts/Quest/RoundControllerMoM.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Generic;
using Assets.Scripts.Content;
using UnityEngine;

// This round controller extends the standard controller for MoM specific round order
public class RoundControllerMoM : RoundController
Expand All @@ -18,6 +17,18 @@ override public void HeroActivated()
{
game.CurrentQuest.heroes[i].activated = true;
}

if (game.CurrentQuest.vars.GetValue("#eliminatedprev") > 0 &&
game.CurrentQuest.vars.GetValue("#eliminatedcomplete") <= 0)
{
game.CurrentQuest.vars.SetValue("#eliminatedcomplete", 1);
if (game.CurrentQuest.eManager.EventTriggerType("Eliminated", false))
{
game.CurrentQuest.eManager.TriggerEvent();
return;
}
}

game.CurrentQuest.phase = Quest.MoMPhase.mythos;
game.stageUI.Update();
game.monsterCanvas.UpdateList();
Expand All @@ -30,8 +41,6 @@ override public void HeroActivated()

// Display the transition dialog for investigator phase
ChangePhaseWindow.DisplayTransitionWindow(Quest.MoMPhase.mythos);

return;
}

// Mark a monster as activated
Expand Down Expand Up @@ -68,7 +77,8 @@ override public bool ActivateMonster()
if (!game.CurrentQuest.monsters[i].activated)
{
QuestMonster qm = game.CurrentQuest.monsters[i].monsterData as QuestMonster;
if (qm != null && qm.activations != null && qm.activations.Length == 1 && qm.activations[0].IndexOf("Event") == 0
if (qm != null && qm.activations != null && qm.activations.Length == 1 &&
qm.activations[0].IndexOf("Event") == 0
&& game.CurrentQuest.eManager.events[qm.activations[0]].Disabled())
{
// monster cannot be activated, mark as activated
Expand All @@ -88,7 +98,8 @@ override public bool ActivateMonster()

// Find out of this monster is quest specific
QuestMonster qm = toActivate.monsterData as QuestMonster;
if (qm != null && qm.activations != null && qm.activations.Length == 1 && qm.activations[0].IndexOf("Event") == 0)
if (qm != null && qm.activations != null && qm.activations.Length == 1 &&
qm.activations[0].IndexOf("Event") == 0)
{
toActivate.masterStarted = true;
toActivate.activated = true;
Expand All @@ -99,9 +110,11 @@ override public bool ActivateMonster()
{
ActivateMonster(toActivate);
}

// Return false as activations remain
return false;
}

return true;
}

Expand All @@ -115,7 +128,6 @@ public override void EndRound()
// Check if there are events that are required at the end of the round
public override bool CheckNewRound()
{

Game game = Game.Get();

// Return if there is an event open
Expand Down Expand Up @@ -168,7 +180,8 @@ public override bool CheckNewRound()
}

// we need this test to make sure user can do the horro test, as a random event would switch the game to investigator phase
if (!endRoundRequested && game.CurrentQuest.phase == Quest.MoMPhase.horror && game.CurrentQuest.monsters.Count > 0)
if (!endRoundRequested && game.CurrentQuest.phase == Quest.MoMPhase.horror &&
game.CurrentQuest.monsters.Count > 0)
{
return false;
}
Expand Down Expand Up @@ -196,6 +209,7 @@ public override bool CheckNewRound()
// Advance to next round
int round = Mathf.RoundToInt(game.CurrentQuest.vars.GetValue("#round")) + 1;
game.CurrentQuest.vars.SetValue("#round", round);
game.CurrentQuest.log.Add(new Quest.LogEntry(new StringKey("val", "ROUND", round).Translate()));

game.CurrentQuest.log.Add(new Quest.LogEntry(new StringKey("val", "PHASE_INVESTIGATOR").Translate()));

Expand All @@ -206,12 +220,19 @@ public override bool CheckNewRound()
game.audioControl.PlayTrait("newround");

// Start of round events
if (game.CurrentQuest.vars.GetValue("#eliminatedprev") > 0 &&
game.CurrentQuest.vars.GetValue("#eliminatedcomplete") <= 0)
{
game.CurrentQuest.eManager.EventTriggerType("StartFinalRound");
}

game.CurrentQuest.eManager.EventTriggerType("StartRound");

SaveManager.Save(0);

// Display the transition dialog for investigator phase
ChangePhaseWindow.DisplayTransitionWindow(Quest.MoMPhase.investigator);

return true;
}
}
}
1 change: 1 addition & 0 deletions unity/Assets/Scripts/QuestEditor/EditorComponentEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,7 @@ public void SetTrigger()
select.AddItem("Mythos", traits);
select.AddItem("EndInvestigatorTurn", traits);
select.AddItem("BeforeMonsterActivation", traits);
select.AddItem("StartFinalRound", traits);
}

traits = new Dictionary<string, IEnumerable<string>>();
Expand Down
1 change: 1 addition & 0 deletions unity/Assets/Scripts/QuestEditor/QuestEditorData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public static void TypeSelect(string type = "")

Dictionary<string, IEnumerable<string>> traits = new Dictionary<string, IEnumerable<string>>();
traits.Add(CommonStringKeys.TYPE.Translate(), new string[] { "Quest" });
traits.Add(CommonStringKeys.SOURCE.Translate(), new string[] { "quest.ini" });
select.AddItem(CommonStringKeys.QUEST.Translate(), "Quest", traits);

foreach (QuestData.QuestComponent c in game.CurrentQuest.qd.components.Values)
Expand Down
4 changes: 2 additions & 2 deletions unity/ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ PlayerSettings:
16:10: 1
16:9: 1
Others: 0
bundleVersion: 2.5.5a
bundleVersion: 2.5.7
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0
Expand Down Expand Up @@ -164,7 +164,7 @@ PlayerSettings:
tvOS: com.Company.ProductName
buildNumber:
iOS: 0
AndroidBundleVersionCode: 20050051
AndroidBundleVersionCode: 20050070
AndroidMinSdkVersion: 16
AndroidTargetSdkVersion: 0
AndroidPreferredInstallLocation: 1
Expand Down

0 comments on commit 8843cc9

Please sign in to comment.