mirror of
https://github.com/milimoe/FunGame-Testing.git
synced 2025-12-05 08:09:04 +00:00
新的继承方法
This commit is contained in:
parent
2a75147296
commit
6f64861465
@ -12,8 +12,9 @@ ItemModule im = new();
|
|||||||
im.Load();
|
im.Load();
|
||||||
|
|
||||||
FunGameSimulation.InitCharacter();
|
FunGameSimulation.InitCharacter();
|
||||||
|
FunGameSimulation.StartGame(true, false, true);
|
||||||
|
|
||||||
Stopwatch stopwatch = new Stopwatch();
|
Stopwatch stopwatch = new();
|
||||||
stopwatch.Start();
|
stopwatch.Start();
|
||||||
|
|
||||||
for (int i = 0; i < 300; i++)
|
for (int i = 0; i < 300; i++)
|
||||||
|
|||||||
@ -50,7 +50,7 @@ namespace Milimoe.FunGame.Testing.Skills
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
|
public override void OnSkillCasted(Character caster, List<Character> targets, Dictionary<string, object> others)
|
||||||
{
|
{
|
||||||
RemainDuration = Duration;
|
RemainDuration = Duration;
|
||||||
if (!caster.Effects.Contains(this))
|
if (!caster.Effects.Contains(this))
|
||||||
|
|||||||
@ -59,7 +59,7 @@ namespace Milimoe.FunGame.Testing.Skills
|
|||||||
释放时的能量值 = caster.EP;
|
释放时的能量值 = caster.EP;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
|
public override void OnSkillCasted(Character caster, List<Character> targets, Dictionary<string, object> others)
|
||||||
{
|
{
|
||||||
RemainDuration = Duration;
|
RemainDuration = Duration;
|
||||||
if (!caster.Effects.Contains(this))
|
if (!caster.Effects.Contains(this))
|
||||||
|
|||||||
@ -52,7 +52,7 @@ namespace Milimoe.FunGame.Testing.Skills
|
|||||||
character.PhysicalPenetration -= 实际物理穿透提升;
|
character.PhysicalPenetration -= 实际物理穿透提升;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
|
public override void OnSkillCasted(Character caster, List<Character> targets, Dictionary<string, object> others)
|
||||||
{
|
{
|
||||||
RemainDuration = Duration;
|
RemainDuration = Duration;
|
||||||
if (!caster.Effects.Contains(this))
|
if (!caster.Effects.Contains(this))
|
||||||
|
|||||||
@ -51,7 +51,7 @@ namespace Milimoe.FunGame.Testing.Skills
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
|
public override void OnSkillCasted(Character caster, List<Character> targets, Dictionary<string, object> others)
|
||||||
{
|
{
|
||||||
剩余持续次数 = 技能持续次数;
|
剩余持续次数 = 技能持续次数;
|
||||||
if (!caster.Effects.Contains(this))
|
if (!caster.Effects.Contains(this))
|
||||||
|
|||||||
@ -51,7 +51,7 @@ namespace Milimoe.FunGame.Testing.Skills
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
|
public override void OnSkillCasted(Character caster, List<Character> targets, Dictionary<string, object> others)
|
||||||
{
|
{
|
||||||
IEnumerable<Effect> effects = caster.Effects.Where(e => e is 智慧与力量特效);
|
IEnumerable<Effect> effects = caster.Effects.Where(e => e is 智慧与力量特效);
|
||||||
if (effects.Any())
|
if (effects.Any())
|
||||||
|
|||||||
@ -54,7 +54,7 @@ namespace Milimoe.FunGame.Testing.Skills
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
|
public override void OnSkillCasted(Character caster, List<Character> targets, Dictionary<string, object> others)
|
||||||
{
|
{
|
||||||
RemainDuration = Duration;
|
RemainDuration = Duration;
|
||||||
if (!caster.Effects.Contains(this))
|
if (!caster.Effects.Contains(this))
|
||||||
|
|||||||
@ -66,7 +66,7 @@ namespace Milimoe.FunGame.Testing.Skills
|
|||||||
baseHardnessTime *= 0.3;
|
baseHardnessTime *= 0.3;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
|
public override void OnSkillCasted(Character caster, List<Character> targets, Dictionary<string, object> others)
|
||||||
{
|
{
|
||||||
RemainDuration = Duration;
|
RemainDuration = Duration;
|
||||||
if (!caster.Effects.Contains(this))
|
if (!caster.Effects.Contains(this))
|
||||||
|
|||||||
@ -32,9 +32,9 @@ namespace Milimoe.FunGame.Testing.Skills
|
|||||||
private double 智力伤害 => 智力系数 * Skill.Character?.INT ?? 0;
|
private double 智力伤害 => 智力系数 * Skill.Character?.INT ?? 0;
|
||||||
private double 能量系数 => 1.05 * Level;
|
private double 能量系数 => 1.05 * Level;
|
||||||
|
|
||||||
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
|
public override void OnSkillCasted(Character caster, List<Character> targets, Dictionary<string, object> others)
|
||||||
{
|
{
|
||||||
foreach (Character c in enemys)
|
foreach (Character c in targets)
|
||||||
{
|
{
|
||||||
WriteLine($"[ {caster} ] 正在毁灭 [ {c} ] 的能量!!");
|
WriteLine($"[ {caster} ] 正在毁灭 [ {c} ] 的能量!!");
|
||||||
double ep = c.EP;
|
double ep = c.EP;
|
||||||
|
|||||||
@ -37,7 +37,7 @@ namespace Milimoe.FunGame.Testing.Skills
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
|
public override void OnSkillCasted(Character caster, List<Character> targets, Dictionary<string, object> others)
|
||||||
{
|
{
|
||||||
RemainDuration = Duration;
|
RemainDuration = Duration;
|
||||||
if (!caster.Effects.Contains(this))
|
if (!caster.Effects.Contains(this))
|
||||||
|
|||||||
@ -76,7 +76,7 @@ namespace Milimoe.FunGame.Testing.Skills
|
|||||||
baseHardnessTime *= 0.8;
|
baseHardnessTime *= 0.8;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
|
public override void OnSkillCasted(Character caster, List<Character> targets, Dictionary<string, object> others)
|
||||||
{
|
{
|
||||||
RemainDuration = Duration;
|
RemainDuration = Duration;
|
||||||
if (!caster.Effects.Contains(this))
|
if (!caster.Effects.Contains(this))
|
||||||
|
|||||||
@ -50,7 +50,7 @@ namespace Milimoe.FunGame.Testing.Skills
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
|
public override void OnSkillCasted(Character caster, List<Character> targets, Dictionary<string, object> others)
|
||||||
{
|
{
|
||||||
RemainDuration = Duration;
|
RemainDuration = Duration;
|
||||||
if (!caster.Effects.Contains(this))
|
if (!caster.Effects.Contains(this))
|
||||||
|
|||||||
@ -55,7 +55,7 @@ namespace Milimoe.FunGame.Testing.Skills
|
|||||||
character.Recovery(pastHP, pastMP, pastMaxHP, pastMaxMP);
|
character.Recovery(pastHP, pastMP, pastMaxHP, pastMaxMP);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
|
public override void OnSkillCasted(Character caster, List<Character> targets, Dictionary<string, object> others)
|
||||||
{
|
{
|
||||||
RemainDuration = Duration;
|
RemainDuration = Duration;
|
||||||
if (!caster.Effects.Contains(this))
|
if (!caster.Effects.Contains(this))
|
||||||
|
|||||||
@ -69,7 +69,7 @@ namespace Milimoe.FunGame.Testing.Skills
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
|
public override void OnSkillCasted(Character caster, List<Character> targets, Dictionary<string, object> others)
|
||||||
{
|
{
|
||||||
if (!caster.Effects.Contains(this))
|
if (!caster.Effects.Contains(this))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -40,11 +40,11 @@ namespace Milimoe.FunGame.Testing.Skills
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
|
public override void OnSkillCasted(Character caster, List<Character> targets, Dictionary<string, object> others)
|
||||||
{
|
{
|
||||||
if (enemys.Count > 0)
|
if (targets.Count > 0)
|
||||||
{
|
{
|
||||||
Character enemy = enemys[new Random().Next(enemys.Count)];
|
Character enemy = targets[0];
|
||||||
DamageToEnemy(caster, enemy, true, MagicType, Damage);
|
DamageToEnemy(caster, enemy, true, MagicType, Damage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,9 +4,9 @@ using System.Text.Json.Serialization;
|
|||||||
|
|
||||||
namespace DataSetJsonConverter
|
namespace DataSetJsonConverter
|
||||||
{
|
{
|
||||||
class Program
|
public class DataSetTest
|
||||||
{
|
{
|
||||||
static void Main(string[] args)
|
public DataSetTest()
|
||||||
{
|
{
|
||||||
Person p1 = new(1, "YES", DateTime.Now);
|
Person p1 = new(1, "YES", DateTime.Now);
|
||||||
Person p2 = new(2, "NO", DateTime.Now);
|
Person p2 = new(2, "NO", DateTime.Now);
|
||||||
@ -23,7 +23,7 @@ namespace DataSetJsonConverter
|
|||||||
|
|
||||||
jsonString = "[" + jsonString.Replace("}{", "},{") + "]";
|
jsonString = "[" + jsonString.Replace("}{", "},{") + "]";
|
||||||
|
|
||||||
var people = JsonSerializer.Deserialize<Person[]>(jsonString, options);
|
Person[] people = JsonSerializer.Deserialize<Person[]>(jsonString, options) ?? [];
|
||||||
|
|
||||||
foreach (var person in people)
|
foreach (var person in people)
|
||||||
{
|
{
|
||||||
@ -45,13 +45,13 @@ namespace DataSetJsonConverter
|
|||||||
{
|
{
|
||||||
if (reader.TokenType == JsonTokenType.PropertyName)
|
if (reader.TokenType == JsonTokenType.PropertyName)
|
||||||
{
|
{
|
||||||
string propertyName = reader.GetString();
|
string propertyName = reader.GetString() ?? "";
|
||||||
|
|
||||||
switch (propertyName)
|
switch (propertyName)
|
||||||
{
|
{
|
||||||
case "TableName":
|
case "TableName":
|
||||||
reader.Read();
|
reader.Read();
|
||||||
string tableName = reader.GetString();
|
string tableName = reader.GetString() ?? "";
|
||||||
dataTable = new DataTable(tableName);
|
dataTable = new DataTable(tableName);
|
||||||
dataSet.Tables.Add(dataTable);
|
dataSet.Tables.Add(dataTable);
|
||||||
break;
|
break;
|
||||||
@ -197,7 +197,7 @@ namespace DataSetJsonConverter
|
|||||||
{
|
{
|
||||||
if (reader.TokenType == JsonTokenType.PropertyName)
|
if (reader.TokenType == JsonTokenType.PropertyName)
|
||||||
{
|
{
|
||||||
string propertyName = reader.GetString();
|
string propertyName = reader.GetString() ?? "";
|
||||||
|
|
||||||
switch (propertyName)
|
switch (propertyName)
|
||||||
{
|
{
|
||||||
@ -208,7 +208,7 @@ namespace DataSetJsonConverter
|
|||||||
|
|
||||||
case "DataType":
|
case "DataType":
|
||||||
reader.Read();
|
reader.Read();
|
||||||
Type dataType = Type.GetType(reader.GetString());
|
Type dataType = Type.GetType(reader.GetString() ?? "") ?? typeof(string);
|
||||||
column.DataType = dataType;
|
column.DataType = dataType;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -258,11 +258,11 @@ namespace DataSetJsonConverter
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "System.Char":
|
case "System.Char":
|
||||||
values[index] = reader.GetString()[0];
|
values[index] = (reader.GetString() ?? "")[0];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "System.DateTime":
|
case "System.DateTime":
|
||||||
string dateString = reader.GetString();
|
string dateString = reader.GetString() ?? "";
|
||||||
if (DateTime.TryParseExact(dateString, _format, null, System.Globalization.DateTimeStyles.None, out DateTime result))
|
if (DateTime.TryParseExact(dateString, _format, null, System.Globalization.DateTimeStyles.None, out DateTime result))
|
||||||
{
|
{
|
||||||
values[index] = result;
|
values[index] = result;
|
||||||
@ -278,7 +278,7 @@ namespace DataSetJsonConverter
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "System.Guid":
|
case "System.Guid":
|
||||||
values[index] = Guid.Parse(reader.GetString());
|
values[index] = Guid.Parse(reader.GetString() ?? "");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "System.Int16":
|
case "System.Int16":
|
||||||
@ -302,7 +302,7 @@ namespace DataSetJsonConverter
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "System.String":
|
case "System.String":
|
||||||
values[index] = reader.GetString();
|
values[index] = reader.GetString() ?? "";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "System.UInt16":
|
case "System.UInt16":
|
||||||
@ -336,7 +336,7 @@ namespace DataSetJsonConverter
|
|||||||
throw new JsonException();
|
throw new JsonException();
|
||||||
}
|
}
|
||||||
|
|
||||||
string dateString = reader.GetString();
|
string dateString = reader.GetString() ?? "";
|
||||||
|
|
||||||
if (DateTime.TryParseExact(dateString, _format, null, System.Globalization.DateTimeStyles.None, out DateTime result))
|
if (DateTime.TryParseExact(dateString, _format, null, System.Globalization.DateTimeStyles.None, out DateTime result))
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user