Added a bunch of moves
This commit is contained in:
@@ -17,7 +17,7 @@ object MoveType extends Enumeration {
|
||||
class MoveTypeType extends TypeReference[MoveType.type]
|
||||
|
||||
object Target extends Enumeration {
|
||||
val Normal, Self, AllAdjacentFoes = Value
|
||||
val Normal, Self, Any, AllAdjacent, AllAdjacentFoes = Value
|
||||
}
|
||||
class TargetType extends TypeReference[Target.type]
|
||||
|
||||
@@ -52,7 +52,7 @@ abstract class Move extends MoveTurn {
|
||||
val desc: String
|
||||
val category: MoveType
|
||||
val pow: Int
|
||||
val powCallback: (Monster, Monster) => Int
|
||||
val powCallback: (Monster, Move, Monster) => Int
|
||||
val prior: Int
|
||||
val accuracy: Int
|
||||
val pp: Int
|
||||
@@ -135,7 +135,7 @@ abstract class Move extends MoveTurn {
|
||||
val atkStat = if (category == MoveType.Physical) PAtk else MAtk
|
||||
val defStat = if (category == MoveType.Physical) PDef else MDef
|
||||
// TODO : Fixed damage
|
||||
val actualPow = if (powCallback != null) powCallback(user, target) else pow
|
||||
val actualPow = if (powCallback != null) powCallback(user, this, target) else pow
|
||||
val baseDmg = (2 * user.level / 5 + 2) * actualPow * user(atkStat) / (target(defStat) * 50) + 2
|
||||
val effectiveness = target.effectiveness(element)
|
||||
val multiplier = effectiveness * critMultiplier(user, target)
|
||||
@@ -246,14 +246,14 @@ object Move {
|
||||
moves(name)
|
||||
}
|
||||
|
||||
def compilePowCallback(code: String): (Monster, Monster) => Int = {
|
||||
def compilePowCallback(code: String): (Monster, Move, Monster) => Int = {
|
||||
if (code != null) {
|
||||
val tb = runtimeMirror(getClass.getClassLoader).mkToolBox()
|
||||
val tree = tb.parse(
|
||||
s"""
|
||||
|import fmon.stat.Monster
|
||||
|import fmon.stat._
|
||||
|import fmon.stat.Statistic._
|
||||
|def callback(user : Monster, target : Monster): Int = {
|
||||
|def callback(user : Monster, move: Move, target : Monster): Int = {
|
||||
| $code
|
||||
|}
|
||||
|callback _
|
||||
@@ -261,7 +261,7 @@ object Move {
|
||||
val f = tb.compile(tree)
|
||||
val wrapper = f()
|
||||
|
||||
wrapper.asInstanceOf[(Monster, Monster) => Int]
|
||||
wrapper.asInstanceOf[(Monster, Move, Monster) => Int]
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user