Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.0.0 #35

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# Project RPG

*Version 1.0*
*Version 2.0*

Welcome to Project RPG, an innovative RPG envisioned by Sinho Chewi and Alexander Tran. Play as a character in a magical academy who gains increasingly powerful spells through courses.

The game is currently a work-in-progress, with a text-based interface.

# Instructions

## Compilation
Expand Down
4 changes: 2 additions & 2 deletions src/project_rpg/Gui.java
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,8 @@ public class ChangeSkillListener implements ActionListener {

/** Constructor that takes in battle skill NUMBER. */
public ChangeSkillListener(int number, JComboBox<Skill> box) {
number = number - 1;
box = box;
this.number = number - 1;
this.box = box;
}

@Override
Expand Down
67 changes: 64 additions & 3 deletions src/project_rpg/SkillToken.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,37 @@ private void earthAttack() {
}
}
}

/** Controls behavior for spells with lightning attacks. */
private void lightningAttack() {
int monsterCount = 3;
while (true) {
if (monsterCount == 0) {
disappear();
return;
}
if (isReadyForAction(250)) {
int newX = getX() + dirX;
int newY = getY() + dirY;
if (!getGrid().inBounds(newX, newY)) {
disappear();
return;
} else if (getGrid().monsterAt(newX, newY)) {
int damage = skill.attack();
getGrid().reduceHealth(newX, newY, damage, skill.getName());
monsterCount = monsterCount - 1;
move(newX + dirX, newY + dirY);
takeAction();
} else if (getGrid().getTokenAt(newX, newY) != null) {
disappear();
return;
} else {
move(newX, newY);
takeAction();
}
}
}
}

/** Controls behavior for spells that don't attack. */
private void nothing() {
Expand All @@ -56,18 +87,19 @@ private void nothing() {

@Override
public void run() {
getGrid().getPlayer().reduceMana(skill.getCost());
if (skill.getBehavior().equals("straightLine")) {
getGrid().getPlayer().reduceMana(skill.getCost());
straightLine();
}
if (skill.getBehavior().equals("nothing")) {
getGrid().getPlayer().reduceMana(skill.getCost());
nothing();
}
if (skill.getBehavior().equals("earthAttack")) {
getGrid().getPlayer().reduceMana(skill.getCost());
earthAttack();
}
if (skill.getBehavior().equals("windAttack")) {
windAttack();
}
}

/** Controls behavior for spells that move in a straight line. */
Expand Down Expand Up @@ -95,6 +127,35 @@ private void straightLine() {
}
}

/** Controls behavior for spells with wind elements. */
private void windAttack() {
while (true) {
if (isReadyForAction(250)) {
int newX = getX() + dirX;
int newY = getY() + dirY;
if (!getGrid().inBounds(newX, newY)) {
disappear();
return;
} else if (getGrid().monsterAt(newX, newY)) {
int damage = skill.attack();
getGrid().reduceHealth(newX, newY, damage, skill.getName());
int knockX = newX + 3 * dirX;
int knockY = newY + 3 * dirY;
Token monsterToken = getGrid().getTokenAt(newX, newY);
monsterToken.forceMove(knockX, knockY);
disappear();
return;
} else if (getGrid().getTokenAt(newX, newY) != null) {
disappear();
return;
} else {
move(newX, newY);
takeAction();
}
}
}
}

/** The direction of movement of the spell. */
private int dirX;
private int dirY;
Expand Down
12 changes: 12 additions & 0 deletions src/project_rpg/Token.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,18 @@ protected void down() {
move(positionX, positionY + 1);
orientation = BattleGrid.RIGHT_ANGLE;
}

/** Makes me move forcibly to (NEWX, NEWY). */
protected void forceMove(int newX, int newY) {
if (grid.valid(newX, newY)) {
grid.addTokenAt(null, positionX, positionY);
grid.addTokenAt(this, newX, newY);
positionX = newX;
positionY = newY;
lastMovement = System.currentTimeMillis();
grid.repaint();
}
}

/** Returns the BattleGrid in which the Token is located. */
protected BattleGrid getGrid() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
{
"courseTitle": "Introduction to Lightning Magic",
"description": "Covers the basics of handling Lightning magic, culminating in the production of a Lightning Ball.",
"skill": "lightning_ball",
"description": "Covers the basics of handling Lightning magic, culminating in the production of a Lightning Bolt.",
"skill": "lightning_bolt",
"1": {
"name": "Lightning Ball Basics I",
"description": "Learn how to handle a Lightning Ball.",
"name": "Lightning Bolt Basics I",
"description": "Learn how to handle a Lightning Bolt.",
"dungeon": "test_dungeon"
},
"2": {
"name": "Lightning Ball Basics II",
"description": "Learn how to handle a Lightning Ball.",
"name": "Lightning Bolt Basics II",
"description": "Learn how to handle a Lightning Bolt.",
"dungeon": "test_dungeon"
},
"3": {
"name": "Lightning Ball Basics III",
"description": "Learn how to handle a Lightning Ball.",
"name": "Lightning Bolt Basics III",
"description": "Learn how to handle a Lightning Bolt.",
"dungeon": "test_dungeon"
},
"4": {
"name": "Lightning Ball Basics IV",
"description": "Learn how to handle a Lightning Ball.",
"name": "Lightning Bolt Basics IV",
"description": "Learn how to handle a Lightning Bolt.",
"dungeon": "test_dungeon"
},
"5": {
"name": "Lightning Ball Basics: Midterm",
"description": "Learn how to handle a Lightning Ball.",
"name": "Lightning Bolt Basics: Midterm",
"description": "Learn how to handle a Lightning Bolt.",
"dungeon": "test_dungeon"
},
"6": {
"name": "Lightning Ball Basics VI",
"description": "Learn how to handle a Lightning Ball.",
"name": "Lightning Bolt Basics VI",
"description": "Learn how to handle a Lightning Bolt.",
"dungeon": "test_dungeon"
},
"7": {
"name": "Lightning Ball Basics VII",
"description": "Learn how to handle a Lightning Ball.",
"name": "Lightning Bolt Basics VII",
"description": "Learn how to handle a Lightning Bolt.",
"dungeon": "test_dungeon"
},
"8": {
"name": "Lightning Ball Basics VIII",
"description": "Learn how to handle a Lightning Ball.",
"name": "Lightning Bolt Basics VIII",
"description": "Learn how to handle a Lightning Bolt.",
"dungeon": "test_dungeon"
},
"9": {
"name": "Lightning Ball Basics IX",
"description": "Learn how to handle a Lightning Ball.",
"name": "Lightning Bolt Basics IX",
"description": "Learn how to handle a Lightning Bolt.",
"dungeon": "test_dungeon"
},
"10": {
"name": "Lightning Ball Basics X",
"description": "Learn how to handle a Lightning Ball.",
"name": "Lightning Bolt Basics X",
"description": "Learn how to handle a Lightning Bolt.",
"dungeon": "test_dungeon"
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/project_rpg/database/skills/gust.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"baseDamage": 10,
"baseMp": 3,
"behavior": "straightLine",
"behavior": "windAttack",
"cooldown": 1000,
"description": "A gust of wind!",
"image": "Fireball",
"image": "Gust",
"name": "Gust"
}

10 changes: 0 additions & 10 deletions src/project_rpg/database/skills/lightning_ball.json

This file was deleted.

10 changes: 10 additions & 0 deletions src/project_rpg/database/skills/lightning_bolt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"baseDamage": 10,
"baseMp": 3,
"behavior": "lightningAttack",
"cooldown": 1000,
"description": "A bolt of lightning!",
"image": "LightningBolt",
"name": "Lightning bolt"
}

Binary file added src/project_rpg/resources/Gust.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/project_rpg/resources/LightningBolt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.