Skip to content

Commit 00b4967

Browse files
committed
upload files
1 parent c871ef5 commit 00b4967

File tree

7 files changed

+490
-0
lines changed

7 files changed

+490
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.vs/
2+
bin/
3+
obj/

Deathmatch.sln

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.1.32319.34
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Deathmatch", "Deathmatch\Deathmatch.csproj", "{BF624042-FC45-4DED-998D-8E93A607D2CE}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{BF624042-FC45-4DED-998D-8E93A607D2CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{BF624042-FC45-4DED-998D-8E93A607D2CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{BF624042-FC45-4DED-998D-8E93A607D2CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{BF624042-FC45-4DED-998D-8E93A607D2CE}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {FA7D026C-CB97-45CF-8F4C-0B3F05B27D4F}
24+
EndGlobalSection
25+
EndGlobal

Deathmatch/Config.cs

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
using Microsoft.Xna.Framework;
2+
using Newtonsoft.Json;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.IO;
6+
using System.Linq;
7+
using System.Text;
8+
using System.Threading;
9+
using System.Threading.Tasks;
10+
using Terraria;
11+
using TShockAPI;
12+
using Z.Expressions;
13+
14+
namespace Deathmatch
15+
{
16+
public class Room
17+
{
18+
[JsonProperty("图格坐标x")]
19+
public int TileX { get; set; }
20+
[JsonProperty("图格坐标y")]
21+
public int TileY { get; set; }
22+
[JsonProperty("长度")]
23+
public int Width { get; set; }
24+
[JsonProperty("高度")]
25+
public int Height { get; set; }
26+
}
27+
public class Skill
28+
{
29+
//技能名称 弹幕id 图像 生成位置 生成间隔 生成时间间隔
30+
//使用冷却时间 使用消耗魔力 触发条件
31+
[JsonProperty("技能名称")]
32+
public string Name { get; set; } = "";
33+
[JsonProperty("弹幕id")]
34+
public int Id { get; set; } = 1;
35+
[JsonProperty("伤害")]
36+
public int Damage { get; set; } = 100;
37+
[JsonProperty("击退")]
38+
public float KnockBack { get; set; } = 1;
39+
[JsonProperty("解析式 自变量为x")]
40+
public string Func { get; set; } = "x^2";
41+
//技能触发动作 wasd u-使用物品 p-跳跃
42+
[JsonProperty("技能触发动作 wasd-上下左右 p-跳跃 u-使用物品")]
43+
public string Trigger { get; set; } = "";
44+
[JsonProperty("原点位置x偏移量")]
45+
public int X { get; set; } = 0;
46+
[JsonProperty("原点位置y偏移量")]
47+
public int Y { get; set; } = 0;
48+
[JsonProperty("自变量取值范围0-此值")]
49+
public int Legnth { get; set; } = 10;
50+
[JsonProperty("自变量每次增量")]
51+
public float Step { get; set; } = 0.1f;
52+
[JsonProperty("时间间隔 ms")]
53+
public int TimeSpan { get; set; } = 100;
54+
[JsonProperty("是否以敌方为攻击对象")]
55+
public bool Trace { get; set; } = false;
56+
[JsonProperty("技能冷却时间 ms")]
57+
public int UseSpan { get; set; } = 2000;
58+
[JsonProperty("技能消耗魔法值")]
59+
public int Mana { get; set; } = 10;
60+
public bool Release(TSPlayer user,TSPlayer anamy)
61+
{
62+
if (user.TPlayer.statMana < Mana)
63+
{
64+
return false;
65+
}
66+
Utils.SendTextAboveHead(user.Index, Name, Color.Red);
67+
user.TPlayer.statMana -= Mana;
68+
user.SendData(PacketTypes.PlayerMana, "", user.Index);
69+
for (float i = 0; i < Legnth; i += Step)
70+
{
71+
var pos = user.TPlayer.position + new Vector2(X+i, Eval.Execute<float>(Func, new { x = i })+Y);
72+
Projectile.NewProjectile(null, pos, Trace ? anamy.TPlayer.position - pos : pos - (new Vector2(X, Y) + user.TPlayer.position), Id, Damage, KnockBack);
73+
Thread.Sleep(TimeSpan);
74+
}
75+
return true;
76+
}
77+
}
78+
public class Character
79+
{
80+
[JsonProperty("角色名")]
81+
public string Name { get; set; }
82+
[JsonProperty("技能")]
83+
public Skill[] Skills { get; set; } = new Skill[] { new Skill() };
84+
}
85+
public class Config
86+
{
87+
[JsonProperty("房间")]
88+
public Room[] Rooms { get; set; } = new Room[] { new Room() };
89+
[JsonProperty("角色")]
90+
public Character[] Characters { get; set; }=new Character[] { new Character() };
91+
private const string path = "tshock/Deathmatch.json";
92+
public void Save()
93+
{
94+
File.WriteAllText(path, JsonConvert.SerializeObject(this, Formatting.Indented),Encoding.UTF8);
95+
}
96+
public static Config GetConfig()
97+
{
98+
if (!File.Exists(path))
99+
new Config().Save();
100+
return JsonConvert.DeserializeObject<Config>(File.ReadAllText(path));
101+
}
102+
}
103+
}

Deathmatch/Deathmatch.csproj

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<AssemblyName>Deathmatch</AssemblyName>
4+
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
5+
<TargetFramework>net6</TargetFramework>
6+
</PropertyGroup>
7+
<PropertyGroup>
8+
<LangVersion>Preview</LangVersion>
9+
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
10+
</PropertyGroup>
11+
<PropertyGroup>
12+
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
13+
</PropertyGroup>
14+
<ItemGroup>
15+
<PackageReference Include="OTAPI.Upcoming" Version="3.1.20" />
16+
<PackageReference Include="TShock" Version="5.1.3" />
17+
<PackageReference Include="Z.Expressions.Eval" Version="4.0.92" />
18+
</ItemGroup>
19+
</Project>

0 commit comments

Comments
 (0)