Browse Source

fix: 🐛 fix the bug about WriteAnswer

tags/0.1.0
shangfengh 2 years ago
parent
commit
fc38a77799
5 changed files with 17 additions and 11 deletions
  1. +6
    -2
      logic/GameClass/GameObj/Map/Generator.cs
  2. +2
    -5
      logic/Gaming/ActionManager.cs
  3. +1
    -1
      logic/Gaming/AttackManager.cs
  4. +2
    -1
      logic/Gaming/SkillManager/SkillManager.ActiveSkill.cs
  5. +6
    -2
      logic/Preparation/Utility/GameData.cs

+ 6
- 2
logic/GameClass/GameObj/Map/Generator.cs View File

@@ -20,7 +20,7 @@ namespace GameClass.GameObj
public int DegreeOfRepair
{
get => degreeOfRepair;
set
private set
{
lock (gameObjLock)
{
@@ -31,10 +31,14 @@ namespace GameClass.GameObj
}
}

public bool Repair(int addDegree)
public bool Repair(int addDegree, Character character)
{
if (DegreeOfRepair == GameData.degreeOfFixedGenerator) return false;
int orgDegreeOfRepair = degreeOfRepair;
DegreeOfRepair += addDegree;
if (DegreeOfRepair > orgDegreeOfRepair)
character.AddScore(GameData.StudentScoreFix(DegreeOfRepair) - GameData.StudentScoreFix(orgDegreeOfRepair));
else character.AddScore(GameData.TrickerScoreDamageGenerator(orgDegreeOfRepair) - GameData.TrickerScoreDamageGenerator(DegreeOfRepair));
if (DegreeOfRepair == GameData.degreeOfFixedGenerator)
return true;
else return false;


+ 2
- 5
logic/Gaming/ActionManager.cs View File

@@ -67,14 +67,11 @@ namespace Gaming
(
() =>
{
int ScoreAdded = GameData.StudentScoreFix(generatorForFix.DegreeOfRepair);
new FrameRateTaskExecutor<int>(
loopCondition: () => player.PlayerState == PlayerStateType.Fixing && gameMap.Timer.IsGaming && generatorForFix.DegreeOfRepair < GameData.degreeOfFixedGenerator,
loopToDo: () =>
{
generatorForFix.Repair(player.FixSpeed * GameData.frameDuration);
player.AddScore(GameData.StudentScoreFix(generatorForFix.DegreeOfRepair - ScoreAdded));
ScoreAdded = GameData.StudentScoreFix(generatorForFix.DegreeOfRepair);
generatorForFix.Repair(player.FixSpeed * GameData.frameDuration, player);
},
timeInterval: GameData.frameDuration,
finallyReturn: () => 0
@@ -363,7 +360,7 @@ namespace Gaming
player.ReSetPos(windowToPlayer + windowForClimb.Position, PlaceType.Window);
player.MoveSpeed = player.SpeedOfClimbingThroughWindows;

moveEngine.MoveObj(player, (int)(windowToPlayer.Length() * 3.0 * 1000 / player.MoveSpeed), (-1 * windowToPlayer).Angle());
moveEngine.MoveObj(player, (int)(windowToPlayer.Length() * 1000 / player.MoveSpeed), (-1 * windowToPlayer).Angle());

new FrameRateTaskExecutor<int>(
loopCondition: () => player.PlayerState == PlayerStateType.ClimbingThroughWindows && gameMap.Timer.IsGaming,


+ 1
- 1
logic/Gaming/AttackManager.cs View File

@@ -57,7 +57,7 @@ namespace Gaming
break;
case GameObjType.Generator:
if (bullet.CanBeBombed(GameObjType.Generator))
((Generator)objBeingShot).DegreeOfRepair -= bullet.AP * GameData.factorDamageGenerator;
((Generator)objBeingShot).Repair(-bullet.AP * GameData.factorDamageGenerator, (Character)bullet.Parent);
break;
default:
break;


+ 2
- 1
logic/Gaming/SkillManager/SkillManager.ActiveSkill.cs View File

@@ -69,7 +69,8 @@ namespace Gaming
Generator? generator = (Generator?)gameMap.OneForInteract(player.Position, GameObjType.Generator);
if (generator != null)
{
generator.Repair(((WriteAnswers)activeSkill).DegreeOfMeditation);
if (generator.Repair(((WriteAnswers)activeSkill).DegreeOfMeditation, player))
gameMap.NumOfRepairedGenerators++;
Debugger.Output(player, "uses WriteAnswers in" + generator.ToString() + "with " + (((WriteAnswers)activeSkill).DegreeOfMeditation).ToString());
((WriteAnswers)activeSkill).DegreeOfMeditation = 0;
}


+ 6
- 2
logic/Preparation/Utility/GameData.cs View File

@@ -135,13 +135,17 @@ namespace Preparation.Utility
{
return time;
}
public static int TrickerScoreDamageGenerator(int degree)
{
return degree * 200 / degreeOfFixedGenerator;
}

public static int StudentScoreFix(int degreeOfFix)
{
return degreeOfFix;
return degreeOfFix * 200 / degreeOfFixedGenerator;
}
public const int StudentScoreFixed = 25;
public static int StudentScorePinDown(int timeOfPiningDown)
public static int StudentScorePinDown(int timeOfPinningDown)
{
return 0;
}


Loading…
Cancel
Save