Quote from: Windstorm on April 22, 2024, 05:46:08 PMIt's your birthday! You have just turned 24.
You can now hold no more than four limes.
Quote from: Kavrick on Today at 02:50:53 PMQuote from: Pariah on Today at 02:38:11 PMSo changing the system of stats would essentially be a total rewrite, then after you got stats done, you'd have to find everything that pulled from that old code of stats that no longer existed and fix those. Let's say that every weapon skill, every offense/defense skill and magick all pull off the stats basics, that's basically re-writing the whole game when it's all said and done.Oh I know a learning-by-doing stat system would be a much bigger task, but I feel like switching from random stats at creation to non-random stats at creation wouldn't be such a massive task.
Quote from: Pariah on Today at 02:38:11 PMSo changing the system of stats would essentially be a total rewrite, then after you got stats done, you'd have to find everything that pulled from that old code of stats that no longer existed and fix those. Let's say that every weapon skill, every offense/defense skill and magick all pull off the stats basics, that's basically re-writing the whole game when it's all said and done.Oh I know a learning-by-doing stat system would be a much bigger task, but I feel like switching from random stats at creation to non-random stats at creation wouldn't be such a massive task.
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;
// Skill class representing individual skills
class Skill {
private String name;
private int level;
private int cooldown;
private boolean isOnCooldown;
public Skill(String name) {
this.name = name;
this.level = 1;
this.cooldown = 0;
this.isOnCooldown = false;
}
public String getName() {
return name;
}
public int getLevel() {
return level;
}
public int getCooldown() {
return cooldown;
}
public boolean isOnCooldown() {
return isOnCooldown;
}
public void levelUp() {
level++;
System.out.println(name + " has leveled up to " + level);
}
public void startCooldown(int cooldownTime) {
isOnCooldown = true;
Timer cooldownTimer = new Timer();
cooldownTimer.schedule(new TimerTask() {
@Override
public void run() {
isOnCooldown = false;
cooldownTimer.cancel();
}
}, cooldownTime * 1000); // Convert cooldown to milliseconds
System.out.println(name + " is now on cooldown for " + cooldownTime + " seconds");
}
}
// Player class representing a player in the game
class Player {
private String name;
private int strength;
private int wisdom;
private int agility;
private int endurance;
private Map<String, Skill> skills;
public Player(String name, int strength, int wisdom, int agility, int endurance) {
this.name = name;
this.strength = strength;
this.wisdom = wisdom;
this.agility = agility;
this.endurance = endurance;
this.skills = new HashMap<>();
}
// Method to roll stats randomly
private int rollStat() {
Random random = new Random();
return random.nextInt(5) + 1; // Generating random number between 1 to 5
}
// Method to learn a new skill
public void learnSkill(String skillName) {
Skill skill = new Skill(skillName);
skills.put(skillName, skill);
System.out.println(name + " has learned " + skillName);
}
// Method to improve a skill through learning by doing
public void improveSkill(String skillName) {
Skill skill = skills.get(skillName);
if (skill != null) {
int roll = rollStat(); // Roll for skill improvement
if (roll <= wisdom - (5 - skill.getLevel())) {
skill.levelUp();
} else {
System.out.println(name + " failed to improve " + skillName);
}
} else {
System.out.println(name + " does not have the skill " + skillName);
}
}
// Method to use a skill
public void useSkill(String skillName) {
Skill skill = skills.get(skillName);
if (skill != null && !skill.isOnCooldown()) {
int cooldownTime = (wisdom * 3 * 60) + ((5 - wisdom) * 10 * 60); // Cooldown calculation based on wisdom
skill.startCooldown(cooldownTime);
} else if (skill != null && skill.isOnCooldown()) {
System.out.println(name + "'s " + skillName + " is still on cooldown");
} else {
System.out.println(name + " does not have the skill " + skillName);
}
}
// Getters for player attributes
public String getName() {
return name;
}
public int getStrength() {
return strength;
}
public int getWisdom() {
return wisdom;
}
public int getAgility() {
return agility;
}
public int getEndurance() {
return endurance;
}
}
public class MUDGame {
public static void main(String[] args) {
// Roll stats for the player
Random random = new Random();
int strength = random.nextInt(5) + 1;
int wisdom = random.nextInt(5) + 1;
int agility = random.nextInt(5) + 1;
int endurance = random.nextInt(5) + 1;
// Create a player with rolled stats
Player player1 = new Player("Player1", strength, wisdom, agility, endurance);
// Player1 learns some skills
player1.learnSkill("Combat");
player1.learnSkill("Magic");
// Player1 improves their skills
player1.improveSkill("Combat");
player1.improveSkill("Magic");
// Player1 tries to use skills
player1.useSkill("Combat");
player1.useSkill("Combat"); // Skill is still on cooldown
player1.useSkill("NonExistentSkill"); // Trying to use a skill not learned
}
}
Quote from: AKawaiiBear on Today at 01:55:40 PMi think everyone (even staff) wants a point buy system but god have mercy on the poor soul who actually tries to make it happen on that ancient spaghetti code
Page created in 0.017 seconds with 10 queries.