-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
331 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,57 @@ | ||
using GameClass.GameObj.Occupations; | ||
using Preparation.Interface; | ||
using Preparation.Utility; | ||
using Preparation.Utility.Value; | ||
using Preparation.Utility.Value.SafeValue.LockedValue; | ||
|
||
namespace GameClass.GameObj.Areas; | ||
|
||
public class A_Resource(XY initPos) | ||
: Immovable(initPos, int.MaxValue, GameObjType.Null) | ||
public class A_Resource | ||
: Immovable, IA_Recource | ||
{ | ||
public InVariableRange<long> HP { get; } | ||
public InVariableRange<long> ATKpower { get; } | ||
public InVariableRange<long> AttackPower { get; } | ||
public override bool IsRigid(bool args = false) => false; | ||
private AdditionResourceState State { get; } | ||
private A_ResourceType Type { get; } | ||
protected readonly object actionLock = new(); | ||
public object ActionLock => actionLock; | ||
public IAROccupation Occupation { get; } | ||
private AdditionResourceState State = AdditionResourceState.NULL_ADDITION_RESOURCE_STATE; | ||
public AdditionResourceState ARstate | ||
{ | ||
get | ||
{ | ||
lock (actionLock) | ||
return State; | ||
} | ||
} | ||
public A_ResourceType AResourceType { get; } | ||
public override ShapeType Shape => ShapeType.NULL_SHAPE_TYPE; | ||
public void SetARState(AdditionResourceState state) | ||
{ | ||
State = state; | ||
} | ||
public bool TryToRemoveFromGame() | ||
{ | ||
lock (actionLock) | ||
{ | ||
TryToRemove(); | ||
position = GameData.PosNotInGame; | ||
} | ||
return true; | ||
} | ||
public void Init() | ||
{ | ||
HP.SetMaxV(Occupation.MaxHp); | ||
HP.SetVToMaxV(); | ||
AttackPower.SetMaxV(Occupation.AttackPower); | ||
AttackPower.SetVToMaxV(); | ||
} | ||
public A_Resource(int radius, A_ResourceType type, XY initPos) : | ||
base(initPos, radius, GameObjType.A_Resource) | ||
{ | ||
Occupation = ARFactory.FindAROccupation(Type = type); | ||
HP = new(Occupation.MaxHp); | ||
AttackPower = new(Occupation.AttackPower); | ||
Init(); | ||
} | ||
} |
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,11 @@ | ||
using Preparation.Interface; | ||
using Preparation.Utility; | ||
using Preparation.Utility.Value.SafeValue.LockedValue; | ||
|
||
namespace GameClass.GameObj.Areas; | ||
|
||
public class CrazyMan1 : IAROccupation | ||
{ | ||
public int MaxHp { get; } = GameData.CrazyMan1HP; | ||
public int AttackPower { get; } = GameData.CrazyMan1ATK; | ||
} |
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,11 @@ | ||
using Preparation.Interface; | ||
using Preparation.Utility; | ||
using Preparation.Utility.Value.SafeValue.LockedValue; | ||
|
||
namespace GameClass.GameObj.Areas; | ||
|
||
public class CrazyMan2 : IAROccupation | ||
{ | ||
public int MaxHp { get; } = GameData.CrazyMan2HP; | ||
public int AttackPower { get; } = GameData.CrazyMan2ATK; | ||
} |
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,11 @@ | ||
using Preparation.Interface; | ||
using Preparation.Utility; | ||
using Preparation.Utility.Value.SafeValue.LockedValue; | ||
|
||
namespace GameClass.GameObj.Areas; | ||
|
||
public class CrazyMan3 : IAROccupation | ||
{ | ||
public int MaxHp { get; } = GameData.CrazyMan3HP; | ||
public int AttackPower { get; } = GameData.CrazyMan3ATK; | ||
} |
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,19 @@ | ||
using Preparation.Interface; | ||
using Preparation.Utility; | ||
|
||
namespace GameClass.GameObj.Areas; | ||
|
||
public static class ARFactory | ||
{ | ||
public static IAROccupation FindAROccupation(A_ResourceType type) => type switch | ||
{ | ||
A_ResourceType.CrazyMan1 => new CrazyMan1(), | ||
A_ResourceType.CrazyMan2 => new CrazyMan2(), | ||
A_ResourceType.CrazyMan3 => new CrazyMan3(), | ||
A_ResourceType.LifePool1 => new LifePool1(), | ||
A_ResourceType.LifePool2 => new LifePool2(), | ||
A_ResourceType.LifePool3 => new LifePool3(), | ||
A_ResourceType.QuickStep => new QuickStep(), | ||
A_ResourceType.WideView => new WideView(), | ||
}; | ||
} |
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,11 @@ | ||
using Preparation.Interface; | ||
using Preparation.Utility; | ||
using Preparation.Utility.Value.SafeValue.LockedValue; | ||
|
||
namespace GameClass.GameObj.Areas; | ||
|
||
public class LifePool1 : IAROccupation | ||
{ | ||
public int MaxHp { get; } = GameData.LifePool1HP; | ||
public int AttackPower { get; } = GameData.LifePoolATK; | ||
} |
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,11 @@ | ||
using Preparation.Interface; | ||
using Preparation.Utility; | ||
using Preparation.Utility.Value.SafeValue.LockedValue; | ||
|
||
namespace GameClass.GameObj.Areas; | ||
|
||
public class LifePool2 : IAROccupation | ||
{ | ||
public int MaxHp { get; } = GameData.LifePool2HP; | ||
public int AttackPower { get; } = GameData.LifePoolATK; | ||
} |
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,11 @@ | ||
using Preparation.Interface; | ||
using Preparation.Utility; | ||
using Preparation.Utility.Value.SafeValue.LockedValue; | ||
|
||
namespace GameClass.GameObj.Areas; | ||
|
||
public class LifePool3 : IAROccupation | ||
{ | ||
public int MaxHp { get; } = GameData.LifePool3HP; | ||
public int AttackPower { get; } = GameData.LifePoolATK; | ||
} |
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,11 @@ | ||
using Preparation.Interface; | ||
using Preparation.Utility; | ||
using Preparation.Utility.Value.SafeValue.LockedValue; | ||
|
||
namespace GameClass.GameObj.Areas; | ||
|
||
public class QuickStep : IAROccupation | ||
{ | ||
public int MaxHp { get; } = GameData.QuickStepHP; | ||
public int AttackPower { get; } = GameData.QuickStepATK; | ||
} |
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,11 @@ | ||
using Preparation.Interface; | ||
using Preparation.Utility; | ||
using Preparation.Utility.Value.SafeValue.LockedValue; | ||
|
||
namespace GameClass.GameObj.Areas; | ||
|
||
public class WideView : IAROccupation | ||
{ | ||
public int MaxHp { get; } = GameData.WideViewHP; | ||
public int AttackPower { get; } = GameData.WideViewATK; | ||
} |
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 was deleted.
Oops, something went wrong.
Empty file.
Empty file.
Empty file.
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,126 @@ | ||
using GameClass.GameObj; | ||
using GameClass.GameObj.Map; | ||
using Preparation.Utility; | ||
using Preparation.Utility.Value; | ||
using GameClass.GameObj.Areas; | ||
|
||
|
||
namespace Gaming | ||
{ | ||
public partial class Game | ||
{ | ||
private readonly A_ResourceManager ARmanager; | ||
private class A_ResourceManager(Game game, Map gameMap) | ||
{ | ||
private readonly Game game = game; | ||
private readonly Map map = gameMap; | ||
public static A_Resource? AddAResource(A_ResourceType type, XY pos) | ||
{ | ||
A_Resource NewAResource = new(GameData.AResourceRadius, type, pos); | ||
return NewAResource; | ||
} | ||
public bool activateAR(A_Resource AResource) | ||
{ | ||
if (AResource.ARstate == AdditionResourceState.BEATEN) | ||
{ | ||
return false; | ||
} | ||
gameMap.Add(AResource); | ||
AResource.SetARState(AdditionResourceState.BEATABLE); | ||
return true; | ||
} | ||
public bool BeAttacked(A_Resource AResource, Character character) | ||
{ | ||
if (AResource.ARstate == AdditionResourceState.BEATEN) | ||
return false; | ||
long subHP = character.AttackPower; | ||
AResource.HP.SubPositiveV(subHP); | ||
if (AResource.HP == 0) | ||
{ | ||
long score = 0; | ||
switch (AResource.AResourceType) | ||
{ | ||
case A_ResourceType.CrazyMan1: | ||
score = 4000; | ||
break; | ||
case A_ResourceType.CrazyMan2: | ||
score = 5000; | ||
break; | ||
case A_ResourceType.CrazyMan3: | ||
score = 6000; | ||
break; | ||
case A_ResourceType.LifePool1: | ||
score = 2000; | ||
break; | ||
case A_ResourceType.LifePool2: | ||
score = 3000; | ||
break; | ||
case A_ResourceType.LifePool3: | ||
score = 4000; | ||
break; | ||
case A_ResourceType.QuickStep: | ||
score = 3000; | ||
break; | ||
case A_ResourceType.WideView: | ||
score = 3000; | ||
break; | ||
}//此部分缺失加得分代码 | ||
AResource.SetARState(AdditionResourceState.BEATEN); | ||
return true; | ||
} | ||
AResource.SetARState(AdditionResourceState.BEING_BEATEN); | ||
return true; | ||
} | ||
public bool BeAttacked(A_Resource AResource, long AP) | ||
{ | ||
if (AResource.ARstate == AdditionResourceState.BEATEN) | ||
return false; | ||
long subHP = AP; | ||
AResource.HP.SubPositiveV(subHP); | ||
if (AResource.HP == 0) | ||
{ | ||
long score = 0; | ||
switch (AResource.AResourceType) | ||
{ | ||
case A_ResourceType.CrazyMan1: | ||
score = 4000; | ||
break; | ||
case A_ResourceType.CrazyMan2: | ||
score = 5000; | ||
break; | ||
case A_ResourceType.CrazyMan3: | ||
score = 6000; | ||
break; | ||
case A_ResourceType.LifePool1: | ||
score = 2000; | ||
break; | ||
case A_ResourceType.LifePool2: | ||
score = 3000; | ||
break; | ||
case A_ResourceType.LifePool3: | ||
score = 4000; | ||
break; | ||
case A_ResourceType.QuickStep: | ||
score = 3000; | ||
break; | ||
case A_ResourceType.WideView: | ||
score = 3000; | ||
break; | ||
} | ||
AResource.SetARState(AdditionResourceState.BEATEN); | ||
return true; | ||
} | ||
AResource.SetARState(AdditionResourceState.BEING_BEATEN); | ||
return true; | ||
} | ||
public void Remove(A_Resource AResource) | ||
{ | ||
if (!AResource.TryToRemoveFromGame()) | ||
{ | ||
return; | ||
} | ||
gameMap.Remove(AResource); | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.