Browse Source

feat: add Robot

tags/v0.1.0
shangfengh 2 years ago
parent
commit
7fc93d2c3c
9 changed files with 54 additions and 27 deletions
  1. +3
    -2
      logic/GameClass/GameObj/Bullet/Bullet.Ghost.cs
  2. +1
    -1
      logic/GameClass/GameObj/Bullet/Bullet.cs
  3. +1
    -1
      logic/GameClass/GameObj/Character/Character.Skill.cs
  4. +29
    -9
      logic/GameClass/GameObj/Prop.cs
  5. +7
    -2
      logic/Gaming/ActionManager.cs
  6. +1
    -1
      logic/Preparation/Interface/IMoveable.cs
  7. +9
    -9
      logic/Preparation/Interface/IOccupation.cs
  8. +1
    -0
      logic/Preparation/Utility/EnumType.cs
  9. +2
    -2
      logic/Server/CopyInfo.cs

+ 3
- 2
logic/GameClass/GameObj/Bullet/Bullet.Ghost.cs View File

@@ -71,10 +71,11 @@ namespace GameClass.GameObj
public override int Speed => GameData.basicBulletMoveSpeed * 25 / 10;
public override bool IsRemoteAttack => true;

public override int CastTime => GameData.basicCastTime * 4 / 5;
public const int castTime = GameData.basicCastTime * 6 / 5;
public override int CastTime => castTime;
public override int Backswing => 0;
public override int RecoveryFromHit => 0;
public const int cd = GameData.basicBackswing / 2;
public const int cd = castTime;
public override int CD => cd;
public const int maxBulletNum = 1;
public override int MaxBulletNum => maxBulletNum;


+ 1
- 1
logic/GameClass/GameObj/Bullet/Bullet.cs View File

@@ -43,7 +43,7 @@ namespace GameClass.GameObj
base(Position, radius, GameObjType.Bullet)
{
this.canMove = true;
this.moveSpeed = this.Speed;
this.MoveSpeed = this.Speed;
this.hasSpear = player.TryUseSpear();
this.Parent = player;
}


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

@@ -60,7 +60,7 @@ namespace GameClass.GameObj
this.buffManager = new BuffManager();
this.occupation = OccupationFactory.FindIOccupation(characterType);
this.MaxHp = this.hp = Occupation.MaxHp;
this.OrgMoveSpeed = this.moveSpeed = Occupation.MoveSpeed;
this.MoveSpeed = this.OrgMoveSpeed = Occupation.MoveSpeed;
this.BulletOfPlayer = this.OriBulletOfPlayer = Occupation.InitBullet;
this.concealment = Occupation.Concealment;
this.alertnessRadius = Occupation.AlertnessRadius;


+ 29
- 9
logic/GameClass/GameObj/Prop.cs View File

@@ -23,7 +23,7 @@ namespace GameClass.GameObj
base(initPos, radius, GameObjType.Prop)
{
this.canMove = false;
this.moveSpeed = GameData.PropMoveSpeed;
this.MoveSpeed = GameData.PropMoveSpeed;
}
}

@@ -35,11 +35,28 @@ namespace GameClass.GameObj
//{
// public DebuffMine(XYPosition initPos) : base(initPos) { }
// }

public sealed class CraftingBench : Prop
{
public override bool IsRigid => true;
public override bool IgnoreCollideExecutor(IGameObj targetObj) => false;
public CraftingBench(XY initPos) :
base(initPos)
{
}
public override PropType GetPropType() => PropType.CraftingBench;
}

public abstract class BuffProp : Prop
{
public BuffProp(XY initPos) : base(initPos) { }
}

#region 所有增益道具
/// <summary>
/// 增加速度
/// </summary>
public sealed class AddSpeed : Prop
public sealed class AddSpeed : BuffProp
{
public AddSpeed(XY initPos) :
base(initPos)
@@ -47,10 +64,11 @@ namespace GameClass.GameObj
}
public override PropType GetPropType() => PropType.AddSpeed;
}

/// <summary>
/// 复活甲
/// </summary>
public sealed class AddLifeOrClairaudience : Prop
public sealed class AddLifeOrClairaudience : BuffProp
{
public AddLifeOrClairaudience(XY initPos) :
base(initPos)
@@ -58,7 +76,7 @@ namespace GameClass.GameObj
}
public override PropType GetPropType() => PropType.AddLifeOrClairaudience;
}
public sealed class AddHpOrAp : Prop
public sealed class AddHpOrAp : BuffProp
{
public AddHpOrAp(XY initPos) :
base(initPos)
@@ -66,7 +84,7 @@ namespace GameClass.GameObj
}
public override PropType GetPropType() => PropType.AddHpOrAp;
}
public sealed class RecoveryFromDizziness : Prop
public sealed class RecoveryFromDizziness : BuffProp
{
public RecoveryFromDizziness(XY initPos) :
base(initPos)
@@ -77,28 +95,28 @@ namespace GameClass.GameObj
/// <summary>
/// 矛盾
/// </summary>
public sealed class ShieldOrSpear : Prop
public sealed class ShieldOrSpear : BuffProp
{
public ShieldOrSpear(XY initPos) : base(initPos)
{
}
public override PropType GetPropType() => PropType.ShieldOrSpear;
}
public sealed class Key3 : Prop
public sealed class Key3 : BuffProp
{
public Key3(XY initPos) : base(initPos)
{
}
public override PropType GetPropType() => PropType.Key3;
}
public sealed class Key5 : Prop
public sealed class Key5 : BuffProp
{
public Key5(XY initPos) : base(initPos)
{
}
public override PropType GetPropType() => PropType.Key5;
}
public sealed class Key6 : Prop
public sealed class Key6 : BuffProp
{
public Key6(XY initPos) : base(initPos)
{
@@ -145,6 +163,8 @@ namespace GameClass.GameObj
{
switch (propType)
{
case PropType.CraftingBench:
return new CraftingBench(pos);
case PropType.AddSpeed:
return new AddSpeed(pos);
case PropType.AddLifeOrClairaudience:


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

@@ -191,6 +191,7 @@ namespace Gaming

public bool Treat(Student player, Student? playerTreated = null)
{
if (player.CharacterType == CharacterType.Robot) return false;
if (playerTreated == null)
{
playerTreated = gameMap.StudentForInteract(player.Position);
@@ -230,11 +231,14 @@ namespace Gaming
}
public bool Rescue(Student player, Student? playerRescued = null)
{
if (player.CharacterType == CharacterType.Robot) return false;

if (playerRescued == null)
{
playerRescued = gameMap.StudentForInteract(player.Position);
if (playerRescued == null) return false;
}

if ((!player.Commandable()) || playerRescued.PlayerState != PlayerStateType.Addicted || !GameData.ApproachToInteract(playerRescued.Position, player.Position))
return false;
player.SetPlayerState(PlayerStateType.Rescuing);
@@ -363,9 +367,9 @@ namespace Gaming
}

player.MoveSpeed = player.SpeedOfClimbingThroughWindows;
moveEngine.MoveObj(player, GameData.numOfPosGridPerCell * 3 * 1000 / player.MoveSpeed / 2, (-1 * windowToPlayer).Angle(), stateNum);
moveEngine.MoveObj(player, (int)(GameData.numOfPosGridPerCell * 3 * 1000 / player.MoveSpeed / 2), (-1 * windowToPlayer).Angle(), stateNum);

Thread.Sleep(GameData.numOfPosGridPerCell * 3 * 1000 / player.MoveSpeed / 2);
Thread.Sleep((int)(GameData.numOfPosGridPerCell * 3 * 1000 / player.MoveSpeed / 2));

player.MoveSpeed = player.ReCalculateBuff(BuffType.AddSpeed, player.OrgMoveSpeed, GameData.MaxSpeed, GameData.MinSpeed);

@@ -387,6 +391,7 @@ namespace Gaming
}
public bool LockOrOpenDoor(Character player)
{
if (player.CharacterType == CharacterType.Robot) return false;
if (!(player.Commandable()) || player.PlayerState == PlayerStateType.LockingOrOpeningTheDoor)
return false;
Door? doorToLock = (Door?)gameMap.OneForInteract(player.Position, GameObjType.Door);


+ 1
- 1
logic/Preparation/Interface/IMoveable.cs View File

@@ -7,7 +7,7 @@ namespace Preparation.Interface
public interface IMoveable : IGameObj
{
object ActionLock { get; }
public int MoveSpeed { get; }
public long MoveSpeed { get; }
public bool IsMoving { get; set; }
public bool IsRemoved { get; }
public bool IsAvailableForMove { get; }


+ 9
- 9
logic/Preparation/Interface/IOccupation.cs View File

@@ -275,10 +275,10 @@ namespace Preparation.Interface
}
public class Robot : IStudentType
{
private const int moveSpeed = (int)(GameData.basicStudentMoveSpeed);
private const int moveSpeed = (int)(GameData.basicStudentMoveSpeed * 9 / 10);
public int MoveSpeed => moveSpeed;

private const int maxHp = (int)(GameData.basicHp / 2.5);
private const int maxHp = (int)(GameData.basicHp * 3 / 10);
public int MaxHp => maxHp;

private const int maxGamingAddiction = 0;
@@ -286,25 +286,25 @@ namespace Preparation.Interface

public BulletType InitBullet => BulletType.Null;

public List<ActiveSkillType> ListOfIActiveSkill => new(new ActiveSkillType[] { });
public List<PassiveSkillType> ListOfIPassiveSkill => new(new PassiveSkillType[] { });
public List<ActiveSkillType> ListOfIActiveSkill => new(System.Array.Empty<ActiveSkillType>());
public List<PassiveSkillType> ListOfIPassiveSkill => new(System.Array.Empty<PassiveSkillType>());

public const int fixSpeed = GameData.basicFixSpeed;
public const int fixSpeed = GameData.basicFixSpeed * 85 / 123;
public int FixSpeed => fixSpeed;

public const int treatSpeed = 0;
public int TreatSpeed => treatSpeed;

public const double concealment = GameData.basicConcealment;
public const double concealment = GameData.basicConcealment * 0.8;
public double Concealment => concealment;

public const int alertnessRadius = (int)(GameData.basicStudentAlertnessRadius);
public const int alertnessRadius = 0;
public int AlertnessRadius => alertnessRadius;

public int viewRange = GameData.basicStudentViewRange;
public int viewRange = 0;
public int ViewRange => viewRange;

public int speedOfOpeningOrLocking = GameData.basicSpeedOfOpeningOrLocking;
public int speedOfOpeningOrLocking = 0;
public int SpeedOfOpeningOrLocking => speedOfOpeningOrLocking;

public int speedOfClimbingThroughWindows = 1;


+ 1
- 0
logic/Preparation/Utility/EnumType.cs View File

@@ -71,6 +71,7 @@ namespace Preparation.Utility
AddHpOrAp = 6,
ShieldOrSpear = 7,
RecoveryFromDizziness = 8,
CraftingBench = 9,
}
public enum CharacterType // 职业
{


+ 2
- 2
logic/Server/CopyInfo.cs View File

@@ -58,7 +58,7 @@ namespace Server
{
X = player.Position.x,
Y = player.Position.y,
Speed = player.MoveSpeed,
Speed = (int)player.MoveSpeed,
Determination = player.HP,
Addiction = player.GamingAddiction,
Guid = player.ID,
@@ -106,7 +106,7 @@ namespace Server
{
X = player.Position.x,
Y = player.Position.y,
Speed = player.MoveSpeed,
Speed = (int)player.MoveSpeed,

TrickerType = Transformation.ToTrickerType(player.CharacterType),
Guid = player.ID,


Loading…
Cancel
Save