-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
BuildTools
committed
Feb 19, 2020
1 parent
6404c0e
commit 8d1fd30
Showing
9 changed files
with
415 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
package game.character; | ||
|
||
/** | ||
* キャラクターの体力や魔力などを管理するクラスです。 | ||
*/ | ||
public class Status implements Cloneable | ||
{ | ||
/** | ||
* レベル | ||
*/ | ||
public long lv; | ||
/** | ||
* 最大体力 | ||
*/ | ||
public long mhp; | ||
/** | ||
* 現在体力 | ||
*/ | ||
public long hp; | ||
/** | ||
* 攻撃力 | ||
*/ | ||
public long ap; | ||
/** | ||
* 防御力 | ||
*/ | ||
public long bp; | ||
/** | ||
* 素早さ | ||
*/ | ||
public long sp; | ||
/** | ||
* 魔法攻撃力 | ||
*/ | ||
public long map; | ||
/** | ||
* 魔法防御力 | ||
*/ | ||
public long mbp; | ||
/** | ||
* 最大魔力 | ||
*/ | ||
public long mmp; | ||
/** | ||
* 現在魔力 | ||
*/ | ||
public long mp; | ||
/** | ||
* 回避率 | ||
*/ | ||
public long avoid; | ||
/** | ||
* 逃げられる確率 | ||
*/ | ||
public long flee; | ||
|
||
/** | ||
* ステータスの初期化をします。 | ||
* 設定される値は適当です。 | ||
*/ | ||
public Status() | ||
{ | ||
lv = 1; | ||
mhp = 0; | ||
hp = mhp; | ||
ap = bp = sp = 0; | ||
map = mbp = 0; | ||
mmp = 0; | ||
mp = mmp; | ||
avoid = flee = 0; | ||
} | ||
|
||
/** | ||
* ステータス同士を足し合わせます。 | ||
* | ||
* @param st 足し合わせられるステータス | ||
*/ | ||
public void add(Status st) | ||
{ | ||
mhp += st.mhp; | ||
hp += st.mhp; | ||
ap += st.ap; | ||
bp += st.bp; | ||
sp += st.sp; | ||
map += st.map; | ||
mbp += st.mbp; | ||
mmp += st.mmp; | ||
mp += st.mmp; | ||
avoid += st.avoid; | ||
flee += st.flee; | ||
} | ||
|
||
/** | ||
* ステータスを減らします。 | ||
* | ||
* @param st 減らすステータスを示す | ||
*/ | ||
public void sub(Status st) | ||
{ | ||
mhp -= st.mhp; | ||
hp -= st.hp; | ||
ap -= st.ap; | ||
bp -= st.bp; | ||
sp -= st.sp; | ||
map -= st.map; | ||
mbp -= st.mbp; | ||
mmp -= st.mmp; | ||
mp -= st.mp; | ||
avoid -= st.avoid; | ||
flee -= st.flee; | ||
} | ||
|
||
@Override public Status clone() | ||
{ | ||
try{ | ||
return (Status)super.clone(); | ||
}catch(CloneNotSupportedException cnse){ | ||
/* 絶対に発生しないはず */ | ||
throw new InternalError(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.