Compare commits

...

2 Commits

Author SHA1 Message Date
b59f8a09bd i am bad @ C# 2023-09-23 15:35:57 +02:00
f71ed1c5a7 gema 2023-09-23 15:09:58 +02:00

166
godot/UI.cs Normal file
View File

@ -0,0 +1,166 @@
using Godot;
using System;
public partial class UI : Node2D
{
[Export]
private byte Strength = 5;
[Export]
private byte Perception = 5;
[Export]
private byte Endurance = 5;
[Export]
private byte Charisma = 5;
[Export]
private byte Intelligence = 5;
[Export]
private byte Agility = 5;
[Export]
private byte Luck = 5;
private List<string> = context;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
GD.Randomize();
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
context = new List<string>();
}
public bool StrengthCheck(byte difficulty)
{
uint score = 0;
for (byte i = 0; i < Strength; i++)
{
score += GD.Randi() % 6 + 1;
}
if (score >= difficulty)
{
return true;
}
else
{
return false;
}
}
public bool PerceptionCheck(byte difficulty)
{
uint score = 0;
for (byte i = 0; i < Perception; i++)
{
score += GD.Randi() % 6 + 1;
}
if (score >= difficulty)
{
return true;
}
else
{
return false;
}
}
public bool EnduranceCheck(byte difficulty)
{
uint score = 0;
for (byte i = 0; i < Endurance; i++)
{
score += GD.Randi() % 6 + 1;
}
if (score >= difficulty)
{
return true;
}
else
{
return false;
}
}
public bool CharismaCheck(byte difficulty)
{
uint score = 0;
for (byte i = 0; i < Charisma; i++)
{
score += GD.Randi() % 6 + 1;
}
if (score >= difficulty)
{
return true;
}
else
{
return false;
}
}
public bool IntelligenceCheck(byte difficulty)
{
uint score = 0;
for (byte i = 0; i < Intelligence; i++)
{
score += GD.Randi() % 6 + 1;
}
if (score >= difficulty)
{
return true;
}
else
{
return false;
}
}
public bool AgilityCheck(byte difficulty)
{
uint score = 0;
for (byte i = 0; i < Agility; i++)
{
score += GD.Randi() % 6 + 1;
}
if (score >= difficulty)
{
return true;
}
else
{
return false;
}
}
public bool LuckCheck(byte difficulty)
{
uint score = 0;
for (byte i = 0; i < Luck; i++)
{
score += GD.Randi() % 6 + 1;
}
if (score >= difficulty)
{
return true;
}
else
{
return false;
}
}
public bool isJSON(string text)
{
return text.Contains('{') || text.Contains('}');
}
}