Early Access, v1.0.1
This commit is contained in:
84
Assets/Scripts/Slimes/BasicSlime.cs
Normal file
84
Assets/Scripts/Slimes/BasicSlime.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Assets.Scripts.Slimes
|
||||
{
|
||||
public class BasicSlime
|
||||
{
|
||||
protected int health;
|
||||
protected int maxHealth;
|
||||
protected int maxSecondary;
|
||||
protected int secondary;
|
||||
protected int strength;
|
||||
protected int dexterity;
|
||||
protected int intelligence;
|
||||
protected int level;
|
||||
protected int experience;
|
||||
|
||||
public BasicSlime(Player player)
|
||||
{
|
||||
// { health, maxHealth, secondary, maxSecondary, strength, dexterity, intelligence, playerlevel};
|
||||
int[] playerStats = player.getStats();
|
||||
maxHealth = playerStats[1];
|
||||
health = maxHealth;
|
||||
maxSecondary = playerStats[3];
|
||||
secondary = maxSecondary;
|
||||
strength = playerStats[4];
|
||||
dexterity = playerStats[5];
|
||||
intelligence = playerStats[6];
|
||||
experience = (int)(10 + playerStats[7] * 1.5f);
|
||||
level = playerStats[7];
|
||||
}
|
||||
|
||||
public int[] getStats()
|
||||
{
|
||||
int[] result = { health, maxHealth, secondary, maxSecondary, strength, dexterity, intelligence };
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool takeDamage(int amount, System.Random rand)
|
||||
{
|
||||
if (rand.Next(1, 101) > dexterity + (intelligence / 2))
|
||||
{
|
||||
health = health - amount;
|
||||
}
|
||||
return health <= 0;
|
||||
}
|
||||
|
||||
public int calculateHeavy(System.Random rand)
|
||||
{
|
||||
int result = 0;
|
||||
if (secondary >= maxSecondary / 2)
|
||||
{
|
||||
int bonus = 0;
|
||||
if (rand.Next(1, 101) <= dexterity)
|
||||
{
|
||||
bonus = strength * 2;
|
||||
}
|
||||
result = strength + bonus + 10;
|
||||
secondary = secondary - (maxSecondary / 2);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public int calculateDamage(System.Random rand)
|
||||
{
|
||||
int result;
|
||||
int bonus = 0;
|
||||
if (rand.Next(1, 101) <= dexterity)
|
||||
{
|
||||
bonus = strength * 2;
|
||||
}
|
||||
result = strength + bonus + 5;
|
||||
return result;
|
||||
}
|
||||
|
||||
public int getExperience()
|
||||
{
|
||||
return experience;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user