-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #417 from CWolfs/develop
v1.1.3
- Loading branch information
Showing
24 changed files
with
347 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"Name": "Mission Control", | ||
"Enabled": true, | ||
"Version": "1.1.2", | ||
"Version": "1.1.3", | ||
"Description": "A HBS BattleTech mod that adds custom contract types and varies the encounter specifics such as encounter boundary size, spawn locations, lance numbers and objectives", | ||
"Author": "CWolf", | ||
"Contact": "[email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/Core/ContractTypeBuilders/NodeBuilders/CombatStateBuilder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using UnityEngine; | ||
|
||
using Newtonsoft.Json.Linq; | ||
|
||
using System; | ||
|
||
using MissionControl.EncounterFactories; | ||
using MissionControl.LogicComponents.CombatStates; | ||
|
||
namespace MissionControl.ContractTypeBuilders { | ||
public class CombatStateBuilder : NodeBuilder { | ||
private ContractTypeBuilder contractTypeBuilder; | ||
private JObject state; | ||
|
||
private GameObject parent; | ||
private string name; | ||
private string subType; | ||
|
||
public CombatStateBuilder(ContractTypeBuilder contractTypeBuilder, GameObject parent, JObject state) { | ||
this.contractTypeBuilder = contractTypeBuilder; | ||
this.state = state; | ||
|
||
this.parent = parent; | ||
this.name = state["Name"].ToString(); | ||
this.subType = state["SubType"].ToString(); | ||
} | ||
|
||
public override void Build() { | ||
switch (subType) { | ||
case "DisablePilotDeath": BuildDisablePilotDeath(); break; | ||
default: Main.LogDebug($"[CombatStateBuilder.{contractTypeBuilder.ContractTypeKey}] No support for sub-type '{subType}'. Check for spelling mistakes."); break; | ||
} | ||
} | ||
|
||
private void BuildDisablePilotDeath() { | ||
bool disableInjuries = state.ContainsKey("DisableInjuries") ? (bool)state["DisableInjuries"] : false; | ||
|
||
DisablePilotDeathGameLogic disablePilotDeathGameLogic = CombatStateFactory.CreateDisablePilotDeath(this.parent, this.name, Guid.NewGuid().ToString(), disableInjuries); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using UnityEngine; | ||
|
||
using MissionControl.LogicComponents.CombatStates; | ||
|
||
namespace MissionControl.EncounterFactories { | ||
public class CombatStateFactory { | ||
private static GameObject CreateGameObject(GameObject parent, string name = null) { | ||
GameObject go = new GameObject((name == null) ? "CombatState" : name); | ||
go.transform.parent = parent.transform; | ||
go.transform.localPosition = Vector3.zero; | ||
|
||
return go; | ||
} | ||
|
||
public static DisablePilotDeathGameLogic CreateDisablePilotDeath(GameObject parent, string name, string guid, bool disableInjuries) { | ||
GameObject disablePilotDeathGameObject = CreateGameObject(parent, name); | ||
|
||
DisablePilotDeathGameLogic disablePilotDeathGameLogic = disablePilotDeathGameObject.AddComponent<DisablePilotDeathGameLogic>(); | ||
disablePilotDeathGameLogic.encounterObjectGuid = guid; | ||
disablePilotDeathGameLogic.DisableInjuries = disableInjuries; | ||
|
||
return disablePilotDeathGameLogic; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/Core/EncounterResults/ModifyLanceEvasionTicksByTagResult.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using BattleTech; | ||
using BattleTech.Framework; | ||
|
||
using HBS.Collections; | ||
|
||
using Harmony; | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace MissionControl.Result { | ||
public class ModifyLanceEvasionTicksByTagResult : EncounterResult { | ||
public string[] Tags { get; set; } | ||
public int Amount { get; set; } | ||
|
||
public override void Trigger(MessageCenterMessage inMessage, string triggeringName) { | ||
Main.LogDebug($"[ModifyLanceEvasionTicksByTagResult] Modifying evasion by '{Amount}' on combatants with tags '{String.Concat(Tags)}'"); | ||
List<ICombatant> combatants = ObjectiveGameLogic.GetTaggedCombatants(UnityGameInstance.BattleTechGame.Combat, new TagSet(Tags)); | ||
|
||
Main.LogDebug($"[ModifyLanceEvasionTicksByTagResult] Found'{combatants.Count}' combatants"); | ||
|
||
foreach (ICombatant combatant in combatants) { | ||
if (combatant is AbstractActor) { | ||
AbstractActor actor = combatant as AbstractActor; | ||
|
||
actor.EvasivePipsCurrent += Amount; | ||
if (actor.EvasivePipsCurrent < 0) actor.EvasivePipsCurrent = 0; | ||
|
||
AccessTools.Property(typeof(AbstractActor), "EvasivePipsTotal").SetValue(actor, actor.EvasivePipsCurrent, null); | ||
UnityGameInstance.BattleTechGame.Combat.MessageCenter.PublishMessage(new EvasiveChangedMessage(actor.GUID, actor.EvasivePipsCurrent)); | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.