Browse Source

fix: 🚑 fix the assignment of Student's GamingAddiction

tags/0.1.0
shangfengh 2 years ago
parent
commit
d053b22497
3 changed files with 11 additions and 4 deletions
  1. +2
    -1
      logic/GameClass/GameObj/Character/Character.Student.cs
  2. +5
    -2
      logic/GameClass/GameObj/Map/Map.cs
  3. +4
    -1
      logic/Gaming/SkillManager/SkillManager.ActiveSkill.cs

+ 2
- 1
logic/GameClass/GameObj/Character/Character.Student.cs View File

@@ -110,7 +110,7 @@ namespace GameClass.GameObj
get => gamingAddiction;
set
{
if (gamingAddiction > 0)
if (value > 0)
lock (gameObjLock)
gamingAddiction = value <= MaxGamingAddiction ? value : MaxGamingAddiction;
else
@@ -164,6 +164,7 @@ namespace GameClass.GameObj
{
this.OrgFixSpeed = this.fixSpeed = ((IStudent)Occupation).FixSpeed;
this.TreatSpeed = this.OrgTreatSpeed = ((IStudent)Occupation).TreatSpeed;
this.MaxGamingAddiction = ((IStudent)Occupation).MaxGamingAddiction;
}
}
}

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

@@ -249,10 +249,13 @@ namespace GameClass.GameObj
}
return GameObjForInteract;
}
public bool CanSee(XY pos1, XY pos2, int viewRange)
public bool CanSee(Character player, GameObj gameObj)
{
if ((gameObj.Type == GameObjType.Character) && !((Character)gameObj).IsInvisible) return false;
XY pos1 = player.Position;
XY pos2 = gameObj.Position;
XY del = pos1 - pos2;
if (del * del > viewRange * viewRange) return false;
if (del * del > player.ViewRange * player.ViewRange) return false;
if (del.x > del.y)
{
if (GetPlaceType(pos1) == PlaceType.Grass && GetPlaceType(pos2) == PlaceType.Grass)


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

@@ -86,7 +86,10 @@ namespace Gaming
{
foreach (Character character in gameMap.GameObjDict[GameObjType.Character])
{
if (player.IsGhost() && gameMap.CanSee(player.Position, character.Position, player.ViewRange))
if (player.IsGhost() &&
(player.PlayerState == PlayerStateType.TryingToAttack || player.PlayerState == PlayerStateType.Swinging
|| player.PlayerState == PlayerStateType.UsingSkill || player.PlayerState == PlayerStateType.LockingOrOpeningTheDoor || player.PlayerState == PlayerStateType.OpeningTheChest)
&& gameMap.CanSee(player, character))
{
if (AttackManager.BeStunned(character, GameData.TimeOfGhostFaintingWhenPunish + (player.MaxHp - player.HP) / GameData.TimeFactorOfGhostFainting))
player.AddScore(GameData.StudentScoreTrickerBeStunned(GameData.TimeOfGhostFaintingWhenPunish + (player.MaxHp - player.HP) / GameData.TimeFactorOfGhostFainting));


Loading…
Cancel
Save