-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BuffSelecter basically finished #53
Open
240220
wants to merge
11
commits into
thuasta:develop
Choose a base branch
from
240220:develop
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
72f6564
BuffSelector start
240220 5d34309
Merge branch 'thuasta:develop' into develop
240220 d53442c
changed to Buff
240220 2436f1a
nothing
240220 ed645bb
player changed to character
240220 2124d7d
complete BuffSelector,
240220 7f76a93
Merge branch 'thuasta:develop' into develop
240220 0a71aed
delete thuai-8.sln
240220 25206fd
change character to tank
240220 0031ad2
Merge branch 'thuasta:develop' into develop
240220 df4df06
complete the DefensiveBuff basically
240220 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,235 @@ | ||
using Serilog.Debugging; | ||
using Thuai.Server.GameLogic; | ||
using Thuai.Server.Buff; | ||
|
||
namespace Thuai.Server.BuffSelector; | ||
|
||
|
||
/// <summary> | ||
/// Buffs that can be selected. | ||
/// </summary> | ||
public enum Buff | ||
{ | ||
BULLET_COUNT, // 子弹数量 | ||
BULLET_SPEED, // 子弹移速 | ||
ATTACK_SPEED, // 攻速 | ||
LASER, // 激光 | ||
DAMAGE, // 伤害 | ||
ANTI_ARMOR, // 破甲 | ||
ARMOR, // 护盾 | ||
REFLECT, // 反弹 | ||
DODGE, // 闪避 | ||
KNIFE, // 名刀 | ||
GRAVITY, // 重力 | ||
BLACK_OUT, // 视野限制 | ||
SPEED_UP, // 加速 | ||
FLASH, // 闪现 | ||
DESTROY, // 破坏墙体 | ||
CONSTRUCT, // 建造墙体 | ||
TRAP, // 陷阱 | ||
MISSILE, // 导弹 | ||
KAMUI, // 虚化 | ||
} | ||
|
||
/// <summary> | ||
/// Selects a buff for a tank. | ||
/// </summary> | ||
public class BuffSelector | ||
{ | ||
/// <summary> | ||
/// Three types of buffs. | ||
/// </summary> | ||
private Buff[] OffensiveBuff = new Buff[] | ||
{ | ||
Buff.BULLET_COUNT, | ||
Buff.BULLET_COUNT, | ||
Buff.BULLET_SPEED, | ||
Buff.ATTACK_SPEED, | ||
Buff.ATTACK_SPEED, | ||
Buff.DAMAGE, | ||
Buff.LASER, | ||
Buff.ANTI_ARMOR | ||
}; | ||
private Buff[] DefensiveBuff = new Buff[] | ||
{ | ||
Buff.ARMOR, | ||
Buff.ARMOR, | ||
Buff.ARMOR, | ||
Buff.REFLECT, | ||
Buff.KNIFE, | ||
Buff.GRAVITY, | ||
Buff.DODGE, | ||
Buff.DODGE | ||
}; | ||
private Buff[] UtilityBuff = new Buff[] | ||
{ | ||
Buff.BLACK_OUT, | ||
Buff.SPEED_UP, | ||
Buff.FLASH, | ||
Buff.DESTROY, | ||
Buff.CONSTRUCT, | ||
Buff.KAMUI, | ||
Buff.MISSILE, | ||
Buff.TRAP | ||
}; | ||
private int Round = 1; | ||
|
||
/// <summary> | ||
/// Contructor. | ||
/// </summary> | ||
public BuffSelector() | ||
{ | ||
BuffInit(); | ||
} | ||
|
||
/// <summary> | ||
/// Initializes the buff selector. | ||
/// </summary> | ||
public bool BuffInit() | ||
{ | ||
Random offensiverand = new Random(); | ||
Random defensiverand = new Random(); | ||
Random Utilityrand = new Random(); | ||
OffensiveBuff = OffensiveBuff.OrderBy(x => offensiverand.Next()).ToArray(); | ||
DefensiveBuff = DefensiveBuff.OrderBy(x => defensiverand.Next()).ToArray(); | ||
UtilityBuff = UtilityBuff.OrderBy(x => Utilityrand.Next()).ToArray(); | ||
return true; | ||
} | ||
|
||
/// <summary> | ||
/// Show the available buffs. | ||
/// </summary> | ||
/// <param name="round">The round number.</param> | ||
/// <returns>The available buffs.</returns> | ||
public Buff[] ShowBuff(int round) | ||
{ | ||
Buff[] availableBuff = new Buff[3]; | ||
Round = round; | ||
availableBuff[0] = OffensiveBuff[round-1]; | ||
availableBuff[1] = DefensiveBuff[round-1]; | ||
availableBuff[2] = UtilityBuff[round-1]; | ||
return availableBuff; | ||
} | ||
|
||
/// <summary> | ||
/// Selects a buff. | ||
/// </summary> | ||
/// <param name="tank","num">The tank and the number of the buff.</param> | ||
/// <returns> void </returns> | ||
public void SelectBuff(Tank tank, int num) | ||
{ | ||
switch (num) | ||
{ | ||
case 1: | ||
ChooseOffensiveBuff(tank, OffensiveBuff[Round - 1]); | ||
break; | ||
case 2: | ||
ChooseDefensiveBuff(tank, DefensiveBuff[Round - 1]); | ||
break; | ||
case 3: | ||
ChooseUtilityBuff(tank, UtilityBuff[Round - 1]); | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Chooses an offensive buff. | ||
/// </summary> | ||
/// <param name="tank","buff">The tank and the buff.</param> | ||
/// <returns> void </returns> | ||
private void ChooseOffensiveBuff(Tank tank, Buff buff) | ||
{ | ||
switch (buff) | ||
{ | ||
case Buff.BULLET_COUNT: | ||
O_Buff.BULLET_COUNT(tank); | ||
break; | ||
case Buff.BULLET_SPEED: | ||
O_Buff.BULLET_SPEED(tank); | ||
break; | ||
case Buff.ATTACK_SPEED: | ||
O_Buff.ATTACK_SPEED(tank); | ||
break; | ||
case Buff.LASER: | ||
O_Buff.LASER(tank); | ||
break; | ||
case Buff.DAMAGE: | ||
O_Buff.DAMAGE(tank); | ||
break; | ||
case Buff.ANTI_ARMOR: | ||
O_Buff.ANTI_ARMOR(tank); | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Chooses a defensive buff. | ||
/// </summary> | ||
/// <param name="tank","buff">The tank and the buff.</param> | ||
/// <returns> void </returns> | ||
private void ChooseDefensiveBuff(Tank tank, Buff buff) | ||
{ | ||
switch (buff) | ||
{ | ||
case Buff.ARMOR: | ||
D_Buff.ARMOR(tank); | ||
break; | ||
case Buff.REFLECT: | ||
D_Buff.REFLECT(tank); | ||
break; | ||
case Buff.DODGE: | ||
D_Buff.DODGE(tank); | ||
break; | ||
case Buff.KNIFE: | ||
D_Buff.KNIFE(tank); | ||
break; | ||
case Buff.GRAVITY: | ||
D_Buff.GRAVITY(tank); | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Chooses a utility buff. | ||
/// </summary> | ||
/// <param name="tank","buff">The tank and the buff.</param> | ||
/// <returns> void </returns> | ||
private void ChooseUtilityBuff(Tank tank, Buff buff) | ||
{ | ||
switch (buff) | ||
{ | ||
case Buff.BLACK_OUT: | ||
U_Buff.BLACK_OUT(tank); | ||
break; | ||
case Buff.SPEED_UP: | ||
U_Buff.SPEED_UP(tank); | ||
break; | ||
case Buff.FLASH: | ||
U_Buff.FLASH(tank); | ||
break; | ||
case Buff.DESTROY: | ||
U_Buff.DESTROY(tank); | ||
break; | ||
case Buff.CONSTRUCT: | ||
U_Buff.CONSTRUCT(tank); | ||
break; | ||
case Buff.TRAP: | ||
U_Buff.TRAP(tank); | ||
break; | ||
case Buff.MISSILE: | ||
U_Buff.MISSILE(tank); | ||
break; | ||
case Buff.KAMUI: | ||
U_Buff.KAMUI(tank); | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
} |
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,34 @@ | ||
using Serilog.Debugging; | ||
using Thuai.Server.GameLogic; | ||
|
||
namespace Thuai.Server.Buff; | ||
|
||
public static class D_Buff | ||
{ | ||
public static void ARMOR(Tank tank) | ||
{ | ||
// 护盾 | ||
tank.TankArmor.armorValue++; | ||
} | ||
public static void REFLECT(Tank tank) | ||
{ | ||
// 反弹 | ||
tank.TankArmor.armorValue++; | ||
tank.TankArmor.canReflect = true; | ||
} | ||
public static void DODGE(Tank tank) | ||
{ | ||
// 闪避 | ||
tank.TankArmor.dodgeRate += 0.1 | ||
} | ||
public static void KNIFE(Tank tank) | ||
{ | ||
// 名刀 | ||
tank.TankArmor.knife = "AVAILABLE"; | ||
} | ||
public static void GRAVITY(Tank tank) | ||
{ | ||
// 重力 | ||
tank.TankArmor.gravityField = true; | ||
} | ||
} |
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,49 @@ | ||
using Serilog.Debugging; | ||
using Thuai.Server.GameLogic; | ||
|
||
namespace Thuai.Server.Buff; | ||
|
||
|
||
public static class U_Buff | ||
{ | ||
public static void BLACK_OUT(Tank tank) | ||
{ | ||
// 视野限制 | ||
tank.skills.Add(Skill("BLACK_OUT", 10, 0, false)); | ||
} | ||
public static void SPEED_UP(Tank tank) | ||
{ | ||
// 加速 | ||
tank.skills.Add(Skill("SPEED_UP", 16, 0, false)); | ||
} | ||
public static void FLASH(Tank tank) | ||
{ | ||
// 闪现 | ||
tank.skills.Add(Skill("FLASH", 25, 0, false)); | ||
} | ||
public static void DESTROY(Tank tank) | ||
{ | ||
// 破坏墙体 | ||
tank.skills.Add(Skill("DESTROY", 18, 0, false)); | ||
} | ||
public static void CONSTRUCT(Tank tank) | ||
{ | ||
// 建造墙体 | ||
tank.skills.Add(Skill("CONSTRUCT", 17, 0, false)); | ||
} | ||
public static void TRAP(Tank tank) | ||
{ | ||
// 陷阱 | ||
tank.skills.Add(Skill("TRAP", 25, 0, false)); | ||
} | ||
public static void MISSILE(Tank tank) | ||
{ | ||
// 导弹 | ||
tank.skills.Add(Skill("MISSILE", 30, 0, false)); | ||
} | ||
public static void KAMUI(Tank tank) | ||
{ | ||
// 虚化 | ||
tank.skills.Add(Skill("KAMUI", 40, 0, false)); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't remove
.csproj
file.