Skip to content

Commit

Permalink
Combat Fixes, UI Tweaks for resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
WispyMouse committed Apr 14, 2022
1 parent 431973f commit a23c097
Show file tree
Hide file tree
Showing 33 changed files with 426 additions and 133 deletions.
10 changes: 10 additions & 0 deletions Assets/AddressableAssetsData/link.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<linker>
<assembly fullname="Unity.Addressables, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" preserve="all">
<type fullname="UnityEngine.AddressableAssets.Addressables" preserve="all" />
</assembly>
<assembly fullname="Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" preserve="all">
<type fullname="UnityEngine.ResourceManagement.ResourceProviders.InstanceProvider" preserve="all" />
<type fullname="UnityEngine.ResourceManagement.ResourceProviders.LegacyResourcesProvider" preserve="all" />
<type fullname="UnityEngine.ResourceManagement.ResourceProviders.SceneProvider" preserve="all" />
</assembly>
</linker>
7 changes: 7 additions & 0 deletions Assets/AddressableAssetsData/link.xml.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 18 additions & 18 deletions Assets/Battle/Battle.unity
Original file line number Diff line number Diff line change
Expand Up @@ -899,12 +899,12 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
FoePositions:
- {fileID: 714745214}
- {fileID: 149069897}
- {fileID: 949394675}
- {fileID: 2069146758}
- {fileID: 714745214}
- {fileID: 1299774447}
- {fileID: 1562207137}
- {fileID: 949394675}
FoePF: {fileID: 1517298617485806157, guid: 2509665a9c7c0f0459eb0ef63b3b1613, type: 3}
PlayerHealthHUDPosition: {fileID: 1346996721}
HudPF: {fileID: 422002143583290964, guid: fcc2d76a1cc8c9542922bfd94ed9701d, type: 3}
Expand Down Expand Up @@ -973,8 +973,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 50}
m_SizeDelta: {x: 135.59, y: 100}
m_AnchoredPosition: {x: 0, y: 70}
m_SizeDelta: {x: 250, y: 150}
m_Pivot: {x: 1, y: 0}
--- !u!114 &217541901
MonoBehaviour:
Expand Down Expand Up @@ -1622,7 +1622,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -65, y: 0}
m_SizeDelta: {x: -150, y: 50}
m_SizeDelta: {x: -150, y: 70}
m_Pivot: {x: 0.5, y: 0}
--- !u!114 &398039740
MonoBehaviour:
Expand Down Expand Up @@ -2287,7 +2287,7 @@ RectTransform:
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 140, y: 50}
m_SizeDelta: {x: 140, y: 70}
m_Pivot: {x: 1, y: 0}
--- !u!114 &692919500
MonoBehaviour:
Expand Down Expand Up @@ -3507,7 +3507,7 @@ RectTransform:
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -6, y: -6}
m_SizeDelta: {x: 400, y: 60}
m_SizeDelta: {x: 432.4, y: 60}
m_Pivot: {x: 1, y: 1}
--- !u!114 &996372638
MonoBehaviour:
Expand Down Expand Up @@ -3979,7 +3979,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: -2}
m_AnchoredPosition: {x: 0, y: -2.0000153}
m_SizeDelta: {x: -4, y: 0}
m_Pivot: {x: 0.5, y: 0}
--- !u!114 &1139483652
Expand Down Expand Up @@ -4047,8 +4047,8 @@ MonoBehaviour:
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 24
m_fontSizeBase: 24
m_fontSize: 30
m_fontSizeBase: 30
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
Expand Down Expand Up @@ -5036,8 +5036,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: 0, y: 50}
m_SizeDelta: {x: 600, y: 250}
m_AnchoredPosition: {x: 0, y: 70}
m_SizeDelta: {x: 600, y: 300}
m_Pivot: {x: 0.5, y: 0}
--- !u!114 &1346996722
MonoBehaviour:
Expand Down Expand Up @@ -5564,7 +5564,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Rubble Blocks the Path
m_text: Move the Rubble
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
Expand All @@ -5591,14 +5591,14 @@ MonoBehaviour:
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 37.4
m_fontSize: 44.75
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 1
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 2
m_HorizontalAlignment: 4
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
Expand Down Expand Up @@ -6445,7 +6445,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 420, y: 80}
m_SizeDelta: {x: 476.49, y: 126.7}
m_Pivot: {x: 0, y: 1}
--- !u!114 &1625652283
MonoBehaviour:
Expand Down Expand Up @@ -6625,10 +6625,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ReferenceResolution: {x: 1280, y: 720}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
Expand Down
15 changes: 14 additions & 1 deletion Assets/Battle/BattleState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public override IEnumerator StartState(GlobalStateMachine globalStateMachine, IG
{
LastWasVictory = false;
ConsoleManager.Instance.AddToLog("AOF has hit 0!");
yield return new WaitForSeconds(.2f);
yield return new WaitForSeconds(.6f);
ConsoleManager.Instance.AddToLog("Returning to Town and resting...");
yield return new WaitForSeconds(.6f);
SceneHelperInstance.SaveDataManagerInstance.CurrentSaveData.Day++;
Expand Down Expand Up @@ -186,4 +186,17 @@ public IEnumerator SpawnCurrentWaveAndContinueFight()

yield return StateMachineInstance.PushNewState(new ChoosePartysCommandsState(StateMachineInstance, this));
}

public void UpdateEveryonesVisuals()
{
foreach (FoeMember foe in Opponents.OpposingMembers)
{
foe.Visual.UpdateFromMember();
}

foreach (PartyMember partyMember in PlayerPartyPointer.PartyMembers)
{
partyMember.Hud.UpdateFromPlayer();
}
}
}
42 changes: 36 additions & 6 deletions Assets/Battle/Commands/BattleCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,24 @@ public BattleCommand(CombatMember actor, CombatMember target, MoveBase actionTak

public virtual IEnumerator TakeAction(BattleState battleState)
{
if (!ActingMember.CanAct())
{
yield break;
}

string targetText;
List<CombatMember> targetsAffected = new List<CombatMember>();

switch (ActionTaken.Targeting)
{
case global::Target.Self:
targetText = $"{ActingMember.DisplayName} {ActionTaken.Verbs}";
targetsAffected.Add(ActingMember);
break;
case global::Target.OneAlly:
case global::Target.OneOpposing:
targetText = $"{ActingMember.DisplayName} {ActionTaken.Verbs} {Target.DisplayName}";
targetsAffected.Add(ActingMember);
targetsAffected.Add(Target);
break;
case global::Target.AllOpposing:
if (ActingMember is PartyMember)
Expand Down Expand Up @@ -60,17 +69,35 @@ public virtual IEnumerator TakeAction(BattleState battleState)

if (ActionTaken.IsHealing)
{
ConsoleManager.Instance.AddToLog($"{affectedMember.DisplayName} is refreshed by {damageRoll}");
// ASSUMES ONLY PLAYERS CAN HEAL; temporary
((PartyMember)affectedMember).LoseNRG(-damageRoll);
yield return new WaitForSeconds(ResolveState.WaitAfterLoggingEffect);
if (affectedMember is FoeMember)
{
ConsoleManager.Instance.AddToLog($"{damageRoll} more hitpoints");
((FoeMember)affectedMember).Progress(damageRoll);
battleState.UpdateEveryonesVisuals();
yield return new WaitForSeconds(ResolveState.WaitAfterLoggingEffect);
}
else
{
PartyMember member = (PartyMember)affectedMember;
ConsoleManager.Instance.AddToLog($"{affectedMember.DisplayName} is refreshed by {damageRoll}");
member.LoseNRG(-damageRoll);
battleState.UpdateEveryonesVisuals();
yield return new WaitForSeconds(ResolveState.WaitAfterLoggingEffect);
}
}
else
{
if (affectedMember is FoeMember)
{
FoeMember member = (FoeMember)affectedMember;
if (member.CurProblemJuice <= 0)
{
continue;
}

ConsoleManager.Instance.AddToLog($"{damageRoll} progress is made");
((FoeMember)affectedMember).Progress(damageRoll);
member.Progress(damageRoll);
battleState.UpdateEveryonesVisuals();
yield return new WaitForSeconds(ResolveState.WaitAfterLoggingEffect);
}
else
Expand All @@ -81,12 +108,14 @@ public virtual IEnumerator TakeAction(BattleState battleState)
{
ConsoleManager.Instance.AddToLog($"The party loses {damageRoll} AoF!!!");
battleState.PlayerPartyPointer.LoseAOF(damageRoll);
battleState.UpdateEveryonesVisuals();
yield return new WaitForSeconds(ResolveState.WaitAfterLoggingEffect);
}
else
{
ConsoleManager.Instance.AddToLog($"{affectedMember.DisplayName} loses {damageRoll} NRG");
((PartyMember)affectedMember).LoseNRG(damageRoll);
battleState.UpdateEveryonesVisuals();
yield return new WaitForSeconds(ResolveState.WaitAfterLoggingEffect);
}
}
Expand All @@ -98,6 +127,7 @@ public virtual IEnumerator TakeAction(BattleState battleState)
{
int damageRoll = Random.Range(ActionTaken.DamageFloor, ActionTaken.DamageCeiling + 1);
battleState.PlayerPartyPointer.LoseAOF(damageRoll);
battleState.UpdateEveryonesVisuals();
ConsoleManager.Instance.AddToLog($"The party loses {damageRoll} AoF!!!");
yield return new WaitForSeconds(ResolveState.WaitAfterActionResolves);
}
Expand Down
7 changes: 6 additions & 1 deletion Assets/Battle/Members/CombatMember.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
/// </summary>
public abstract class CombatMember
{
public string DisplayName { get; set; }
public abstract string DisplayName { get; }

public virtual bool CanAct()
{
return true;
}
}
2 changes: 1 addition & 1 deletion Assets/Battle/Members/PlayerParty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public PartyMember GetRandom()

public void LoseAOF(int amount)
{
CurAOF = Mathf.Clamp(0, MaxAOF, CurAOF - amount);
CurAOF = Mathf.Clamp(CurAOF - amount, 0, MaxAOF);
AOFBar.Instance.AOFSlider.value = CurAOF;
}
}
2 changes: 1 addition & 1 deletion Assets/DCJam2022/Buttons/ButtonsSceneHelperTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ public void StartEvent(ObstacleEvent eventToStart)
}

Debug.Log($"Begin {eventToStart.ObstacleName}");
SceneHelperInstance.StartCoroutine(SceneHelper.GlobalStateMachineInstance.PushNewState(new HandleObstacleState(SceneHelperInstance, eventToStart)));
SceneHelperInstance.StartCoroutine(SceneHelper.GlobalStateMachineInstance.PushNewState(new HandleObstacleState(null, SceneHelperInstance, eventToStart)));
}
}
1 change: 0 additions & 1 deletion Assets/DCJam2022/ChoosePartysCommandsState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public void UnsetControls(WarrencrawlInputs activeInput)

public void CommandSelected(CombatMember forMember, PlayerMove command)
{
Debug.Log("Command selected");
managedBattleState.SceneHelperInstance.StartCoroutine(stateMachineInstance.PushNewState(new ChooseTargetForPartyActionState(stateMachineInstance, managedBattleState, forMember, command)));
}

Expand Down
20 changes: 15 additions & 5 deletions Assets/DCJam2022/ChooseTargetForPartyActionState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ public ChooseTargetForPartyActionState(GlobalStateMachine stateMachine, BattleSt
activeBattleState = battleState;
choosingMember = forMember;
forCommand = command;

Debug.Log("New state pushed");
}

public IEnumerator Initialize()
Expand Down Expand Up @@ -49,8 +47,6 @@ public IEnumerator ChangeUp(IGameplayState nextState)

public IEnumerator ExitState(IGameplayState nextState)
{
Debug.Log("ChooseTarget ExitState");

foreach (FoeMember opponent in activeBattleState.Opponents.OpposingMembers)
{
opponent.Visual.ClearTargetable();
Expand Down Expand Up @@ -80,7 +76,21 @@ public IEnumerator StartState(GlobalStateMachine stateMachine, IGameplayState pr
{
if (partyMember == choosingMember)
{
partyMember.Hud.SetChooseTargets("foo", ActionCanceled);
if (forCommand.Targeting == Target.Self)
{
activeBattleState.BattleCommands.Add(new BattleCommand(choosingMember, choosingMember, forCommand));
yield return stateMachine.EndCurrentState();
yield break;
}

if (forCommand.Targeting == Target.AllOpposing)
{
activeBattleState.BattleCommands.Add(new BattleCommand(choosingMember, null, forCommand));
yield return stateMachine.EndCurrentState();
yield break;
}

partyMember.Hud.SetChooseTargets(forCommand, ActionCanceled);
}
else
{
Expand Down
10 changes: 9 additions & 1 deletion Assets/DCJam2022/EncounterBattle/FoeMember.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

public class FoeMember : CombatMember
{
public override string DisplayName { get { return BattleData.Name; } }
public Foe Visual { get; set; }
public FoeBattleData BattleData { get; set; }
public int MaxProblemJuice { get; set; }
Expand Down Expand Up @@ -36,7 +37,14 @@ public void GoNextPhase()

public void Progress(int amount)
{
CurProblemJuice = Mathf.Clamp(0, MaxProblemJuice, CurProblemJuice - amount);
CurProblemJuice = Mathf.Clamp(CurProblemJuice - amount, 0, MaxProblemJuice);
Visual.HealthSlider.value = CurProblemJuice;
}

public override bool CanAct()
{
bool canAct = base.CanAct();
canAct &= CurProblemJuice > 0;
return canAct;
}
}
4 changes: 2 additions & 2 deletions Assets/DCJam2022/EncounterBattle/PartyMember.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

public class PartyMember : CombatMember
{
public override string DisplayName => FromProfile.ProfileName;
public PlayerHealthInCombat Hud { get; set; }
public int MaxNRG { get; set; }
public int CurNRG { get; set; }
Expand All @@ -18,7 +19,6 @@ public PartyMember()
public PartyMember(DelverProfile fromProfile)
{
FromProfile = fromProfile;
DisplayName = fromProfile.ProfileName;
MaxNRG = fromProfile.MaxNRG;
}

Expand All @@ -29,7 +29,7 @@ public void RefreshOutOfBattle()

public void LoseNRG(int amount)
{
CurNRG = Mathf.Clamp(0, MaxNRG, CurNRG - amount);
CurNRG = Mathf.Clamp(CurNRG - amount, 0, MaxNRG);
Hud.NRGSlider.value = amount;
}
}
Loading

0 comments on commit a23c097

Please sign in to comment.