Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

feat: add DebuffMine (Mine in THUAI4). #29

Merged
merged 8 commits into from
Oct 14, 2021
20 changes: 1 addition & 19 deletions logic/GameClass/GameObj/Bullet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace GameClass.GameObj
{
public abstract class Bullet : ObjOfCharacter // LHR摸鱼中...已写完抽象类及一个派生类
public abstract class Bullet : ObjOfCharacter // LHR摸鱼中...
{
private int ap;
/// <summary>
Expand Down Expand Up @@ -71,24 +71,6 @@ public Bullet(XYPosition initPos, Bullet bullet) : base(initPos, bullet.Radius,
public abstract Bullet Clone(); //深复制子弹
}

internal sealed class Bullet0 : Bullet
{
public Bullet0(XYPosition initPos, int radius, int initSpeed, int ap, bool hasSpear) : base(initPos, radius, initSpeed, ap, hasSpear) { }
public Bullet0(Character player, int radius, int initSpeed, int ap) : base(player, radius, initSpeed, ap) { }
public override bool IsRigid => true;
public override ShapeType Shape => ShapeType.Circle;
public override double BulletBombRange => GameData.basicBulletBombRange;

public override bool CanAttack(GameObj target)
{
// 圆形攻击范围
return XYPosition.Distance(this.Position, target.Position) <= this.BulletBombRange;
}
public override Bullet0 Clone()
{
return new Bullet0(this.Position, this.Radius, this.MoveSpeed, this.AP, this.HasSpear);
}
}
internal sealed class AtomBomb : Bullet
{
public AtomBomb(XYPosition initPos, int radius, int initSpeed, int ap, bool hasSpear) : base(initPos, radius, initSpeed, ap, hasSpear) { }
Expand Down
18 changes: 8 additions & 10 deletions logic/GameClass/GameObj/Character.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace GameClass.GameObj
{
public partial class Character : GameObj, ICharacter // 负责人LHR摆烂中...该文件下抽象部分类已基本完工,剩下的在buffmanager里写
public abstract partial class Character : GameObj, ICharacter // 负责人LHR摆烂中...
{
public readonly object propLock = new object();
private object beAttackedLock = new object();
Expand All @@ -22,7 +22,7 @@ private set
lock (gameObjLock)
{
cd = value;
//Debugger.Output(this, string.Format("'s CD has been set to: {0}.", value));
Debugger.Output(this, string.Format("'s CD has been set to: {0}.", value));
}
}
}
Expand Down Expand Up @@ -54,7 +54,7 @@ private set
lock (gameObjLock)
{
ap = value;
//Debugger.Output(this, "'s AP has been set to: " + value.ToString());
Debugger.Output(this, "'s AP has been set to: " + value.ToString());
}
}
}
Expand All @@ -63,8 +63,8 @@ private set
private int score;
public int Score => score; // 当前分数

private int attackRange;
public int AttackRange => attackRange;
private double attackRange;
public double AttackRange => attackRange;

private double vampire; // 回血率:0-1之间
public double Vampire
Expand Down Expand Up @@ -114,7 +114,7 @@ public Prop? PropInventory //持有的道具
lock (gameObjLock)
{
propInventory = value;
//Debugger.Output(this, " picked the prop: " + (holdProp == null ? "null" : holdProp.ToString()));
Debugger.Output(this, " picked the prop: " + (PropInventory == null ? "null" : PropInventory.ToString()));
}
}
}
Expand Down Expand Up @@ -347,9 +347,7 @@ public string Message

public void AddAP(double add, int buffTime) => buffManeger.AddAP(add, buffTime, newVal => { AP = newVal; }, OrgAp);

public void ChangeCD1(double discount, int buffTime) => buffManeger.ChangeCD1(discount, buffTime, newVal => { CD1 = newVal; }, OrgCD1);
public void ChangeCD2(double discount, int buffTime) => buffManeger.ChangeCD2(discount, buffTime, newVal => { CD2 = newVal; }, OrgCD2);
public void ChangeCD3(double discount, int buffTime) => buffManeger.ChangeCD3(discount, buffTime, newVal => { CD3 = newVal; }, OrgCD3);
public void ChangeCD(double discount, int buffTime) => buffManeger.ChangeCD(discount, buffTime, newVal => { CD = newVal; }, OrgCD);

public void AddShield(int shieldTime) => buffManeger.AddShield(shieldTime);
public bool HasShield => buffManeger.HasShield;
Expand Down Expand Up @@ -387,7 +385,7 @@ protected override bool IgnoreCollideExecutor(IGameObj targetObj)
{
return true;
}
else if (targetObj is Mine && ((Mine)targetObj).Parent?.TeamID == TeamID) // 自己队的炸弹忽略碰撞
else if (targetObj is DebuffMine && ((DebuffMine)targetObj).Parent?.TeamID == TeamID) // 自己队的地雷忽略碰撞
{
return true;
}
Expand Down
37 changes: 36 additions & 1 deletion logic/GameClass/GameObj/Prop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace GameClass.GameObj
{
public abstract class Prop : ObjOfCharacter //LHR摆烂中...抽象类及所有增益道具已写完
public abstract class Prop : ObjOfCharacter
{
protected bool laid = false;
public bool Laid => laid; // 道具是否放置在地图上
Expand All @@ -30,6 +30,14 @@ public abstract class BuffProp : Prop
public BuffProp(XYPosition initPos, int radius) : base(initPos, radius) { }
}
/// <summary>
/// 坑人地雷
/// </summary>
public abstract class DebuffMine : Prop
{
public DebuffMine(XYPosition initPos, int radius) : base(initPos, radius) { }
}
#region 所有增益道具
/// <summary>
/// 增加HP
/// </summary>
public sealed class AddHP : BuffProp
Expand Down Expand Up @@ -93,4 +101,31 @@ public sealed class Spear : BuffProp
public Spear(XYPosition initPos, int radius) : base(initPos, radius) { }
public override PropType GetPropType() => PropType.Spear;
}
#endregion
#region 所有坑人地雷
/// <summary>
/// 减速
/// </summary>
public sealed class MinusSpeed : DebuffMine
{
public MinusSpeed(XYPosition initPos, int radius) : base(initPos, radius) { }
public override PropType GetPropType() => PropType.minusSpeed;
}
/// <summary>
/// 减少攻击力
/// </summary>
public sealed class MinusAP : DebuffMine
{
public MinusAP(XYPosition initPos, int radius) : base(initPos, radius) { }
public override PropType GetPropType() => PropType.minusAP;
}
/// <summary>
/// 增加冷却
/// </summary>
public sealed class AddCD : DebuffMine
{
public AddCD(XYPosition initPos, int radius) : base(initPos, radius) { }
public override PropType GetPropType() => PropType.addCD;
}
#endregion
}