This repository has been archived on 2023-11-16. You can view files and clone it, but cannot push or open issues or pull requests.
GOA/godot/UI.cs
2023-09-23 15:35:57 +02:00

167 lines
2.3 KiB
C#

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('}');
}
}