finished incorporating messaging into the UI window and added another custom control to make updating the UI easier
This commit is contained in:
parent
0b52e91a3d
commit
38dbb7fa92
@ -54,7 +54,6 @@ class Game extends Application {
|
||||
val party2 = new Party(p2, new MonsterPtr(Monster.generate("Wild Mon", p2, 500, form2, movepool2)), IndexedSeq(
|
||||
Monster.generate("Sideboard Mon", p2, 500, form2, movepool2)
|
||||
))
|
||||
println(form1.xpCurve)
|
||||
val engine = new BattleEngine(party1, party2)
|
||||
controller.setEngine(engine)
|
||||
|
||||
|
@ -43,7 +43,7 @@ class BattleEngine(val player: Party, val enemy: Party)(implicit val reader: Sig
|
||||
val replace = enemy.pollReplacement(player)
|
||||
enemy.switchIn(replace)
|
||||
} else {
|
||||
println(s"${enemy.trainer} has lost!")
|
||||
this ! Message(s"${enemy.trainer} has lost!")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,17 +15,12 @@ import fmon.stat._
|
||||
import fmon.stat.Statistic._
|
||||
|
||||
class BattleUI extends SignalConsumer {
|
||||
@FXML var usName: jfxsc.Label = _
|
||||
@FXML var usLv: jfxsc.Label = _
|
||||
@FXML var usHealth: jfxsc.Label = _
|
||||
@FXML var usHealthBar: jfxsc.ProgressBar = _
|
||||
@FXML var themName: jfxsc.Label = _
|
||||
@FXML var themLv: jfxsc.Label = _
|
||||
@FXML var themHealth: jfxsc.Label = _
|
||||
@FXML var themHealthBar: jfxsc.ProgressBar = _
|
||||
@FXML var buttonPane: javafx.scene.layout.VBox = _
|
||||
@FXML var messages: jfxsc.TextArea = _
|
||||
|
||||
@FXML var playerMonController: InfoWidget = _
|
||||
@FXML var enemyMonController: InfoWidget = _
|
||||
|
||||
private var engine: BattleEngine = _
|
||||
|
||||
def setEngine(engine: BattleEngine): Unit = {
|
||||
@ -35,19 +30,12 @@ class BattleUI extends SignalConsumer {
|
||||
|
||||
def updateUI(): Unit = {
|
||||
val player = engine.player.lead
|
||||
usName.text = player.name
|
||||
usLv.text = s"Lv. ${player.level}"
|
||||
usHealth.text = s"${player.hp}/${player.maxhp}"
|
||||
usHealthBar.progress = player.hp.toDouble / player.maxhp
|
||||
|
||||
val enemy = engine.enemy.lead
|
||||
themName.text = enemy.name
|
||||
themLv.text = s"Lv. ${enemy.level}"
|
||||
themHealth.text = s"${enemy.hp}/${enemy.maxhp}"
|
||||
themHealthBar.progress = enemy.hp.toDouble / enemy.maxhp
|
||||
|
||||
val buttons = player.base.moves.map(move => loadMoveButton(move))
|
||||
buttonPane.children = buttons
|
||||
|
||||
playerMonController.update(player)
|
||||
enemyMonController.update(enemy)
|
||||
}
|
||||
|
||||
def onMove(move: Move): Unit = {
|
||||
|
38
FakeMon/src/fmon/battle/InfoWidget.fxml
Normal file
38
FakeMon/src/fmon/battle/InfoWidget.fxml
Normal file
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.ProgressBar?>
|
||||
<?import javafx.scene.layout.ColumnConstraints?>
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
<?import javafx.scene.layout.RowConstraints?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<GridPane prefHeight="59.0" prefWidth="200.0" style="-fx-background-color: lightgrey;" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fmon.battle.InfoWidget">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="139.0" minWidth="10.0" prefWidth="139.0" />
|
||||
<ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" maxWidth="95.0" minWidth="10.0" prefWidth="61.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="37.0" minHeight="10.0" prefHeight="22.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="29.0" minHeight="10.0" prefHeight="18.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<Label fx:id="name" text="MonName">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="status" text="Lv. 17" textAlignment="RIGHT" GridPane.columnIndex="1">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<ProgressBar fx:id="healthBar" prefHeight="24.0" prefWidth="200.0" progress="1.0" GridPane.columnSpan="2" GridPane.rowIndex="1" />
|
||||
<Label fx:id="health" text="43/43" GridPane.rowIndex="2">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
</children>
|
||||
</GridPane>
|
30
FakeMon/src/fmon/battle/InfoWidget.scala
Normal file
30
FakeMon/src/fmon/battle/InfoWidget.scala
Normal file
@ -0,0 +1,30 @@
|
||||
package fmon.battle
|
||||
|
||||
import javafx.fxml.FXML
|
||||
import javafx.scene.{control => jfxsc}
|
||||
|
||||
import scalafx.Includes._
|
||||
import scalafx.scene.control._
|
||||
|
||||
import fmon.stat.Monster
|
||||
import fmon.stat._
|
||||
|
||||
class InfoWidget extends javafx.scene.layout.GridPane {
|
||||
@FXML var name: jfxsc.Label = _
|
||||
@FXML var status: jfxsc.Label = _
|
||||
@FXML var health: jfxsc.Label = _
|
||||
@FXML var healthBar: jfxsc.ProgressBar = _
|
||||
|
||||
def update(mon: Monster): Unit = {
|
||||
name.text = mon.name
|
||||
mon.status match {
|
||||
case Some(s) => status.text = s.name
|
||||
case None => status.text = s"Lv. ${mon.level}"
|
||||
}
|
||||
|
||||
health.text = s"${mon.hp}/${mon.maxhp}"
|
||||
val percent = mon.hp \\ mon.maxhp
|
||||
healthBar.progress = percent.toDouble
|
||||
// TODO : Change bar color
|
||||
}
|
||||
}
|
@ -1,21 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.Menu?>
|
||||
<?import javafx.scene.control.MenuBar?>
|
||||
<?import javafx.scene.control.MenuItem?>
|
||||
<?import javafx.scene.control.ProgressBar?>
|
||||
<?import javafx.scene.control.ScrollPane?>
|
||||
<?import javafx.scene.control.SeparatorMenuItem?>
|
||||
<?import javafx.scene.control.TextArea?>
|
||||
<?import javafx.scene.image.Image?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.ColumnConstraints?>
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
<?import javafx.scene.layout.RowConstraints?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<VBox prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fmon.battle.BattleUI">
|
||||
<children>
|
||||
@ -75,70 +69,14 @@
|
||||
<Image url="@images/Darkness%20Slime.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
<GridPane layoutX="14.0" layoutY="502.0" prefHeight="59.0" prefWidth="200.0" style="-fx-background-color: lightgrey;">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="139.0" minWidth="10.0" prefWidth="139.0" />
|
||||
<ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" maxWidth="95.0" minWidth="10.0" prefWidth="61.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="37.0" minHeight="10.0" prefHeight="22.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="29.0" minHeight="10.0" prefHeight="18.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<Label fx:id="usName" text="Batty">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="usLv" text="Lv. 17" textAlignment="RIGHT" GridPane.columnIndex="1">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<ProgressBar fx:id="usHealthBar" prefHeight="24.0" prefWidth="200.0" progress="1.0" GridPane.columnSpan="2" GridPane.rowIndex="1" />
|
||||
<Label fx:id="usHealth" text="43/43" GridPane.rowIndex="2">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
</children>
|
||||
</GridPane>
|
||||
<GridPane layoutX="642.0" layoutY="14.0" prefHeight="59.0" prefWidth="200.0" style="-fx-background-color: lightgrey;">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="137.0" minWidth="10.0" prefWidth="137.0" />
|
||||
<ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" maxWidth="95.0" minWidth="10.0" prefWidth="63.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="37.0" minHeight="10.0" prefHeight="22.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="29.0" minHeight="10.0" prefHeight="18.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<Label fx:id="themName" text="Slime">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="themLv" text="Lv. 17" textAlignment="RIGHT" GridPane.columnIndex="1">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<ProgressBar fx:id="themHealthBar" prefHeight="24.0" prefWidth="200.0" progress="1.0" GridPane.columnSpan="2" GridPane.rowIndex="1" />
|
||||
<Label fx:id="themHealth" text="43/43" GridPane.rowIndex="2">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Label>
|
||||
</children>
|
||||
</GridPane>
|
||||
<ScrollPane hbarPolicy="NEVER" layoutX="32.0" layoutY="29.0" prefHeight="200.0" prefWidth="200.0">
|
||||
<content>
|
||||
<VBox fx:id="buttonPane" />
|
||||
</content>
|
||||
</ScrollPane>
|
||||
<TextArea fx:id="messages" layoutX="440.0" layoutY="449.0" prefHeight="112.0" prefWidth="399.0" />
|
||||
<fx:include fx:id="playerMon" source="InfoWidget.fxml" AnchorPane.bottomAnchor="20.0" AnchorPane.leftAnchor="20.0" />
|
||||
<fx:include fx:id="enemyMon" source="InfoWidget.fxml" AnchorPane.rightAnchor="20.0" AnchorPane.topAnchor="20.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</children>
|
||||
|
@ -61,8 +61,11 @@ object Ability {
|
||||
private val helper = """
|
||||
implicit val gen = rng
|
||||
implicit val signalConsumer = reader
|
||||
def msg(text: String): Unit = {
|
||||
reader ! Message(text)
|
||||
}
|
||||
def trigger {
|
||||
reader ! Message(s"[${mon}'s ${self}]")
|
||||
msg(s"[${mon}'s ${self}]")
|
||||
}
|
||||
def effect = EffectSource(mon, self)
|
||||
"""
|
||||
|
@ -41,7 +41,7 @@ class Monster(val base : StorageMon) {
|
||||
|
||||
def statuses = volatile ++ status
|
||||
|
||||
def cureStatus() {
|
||||
def cureStatus()(implicit reader: SignalConsumer, rng: Random) {
|
||||
status.map(_.onEnd(this))
|
||||
status = None
|
||||
}
|
||||
@ -54,11 +54,11 @@ class Monster(val base : StorageMon) {
|
||||
status = Some(s)
|
||||
s.onStart(this, source)
|
||||
} else {
|
||||
println("But it failed!")
|
||||
reader ! Message("But it failed!")
|
||||
}
|
||||
}
|
||||
|
||||
def -=(s : Status) = {
|
||||
def -=(s : Status)(implicit reader: SignalConsumer, rng: Random) = {
|
||||
if (s.effectType == EffectType.Volatile) {
|
||||
s.onEnd(this)
|
||||
volatile = volatile.filterNot(_.name == s.name)
|
||||
@ -67,13 +67,13 @@ class Monster(val base : StorageMon) {
|
||||
}
|
||||
}
|
||||
|
||||
def applyBoost(s : Stat, boost : Int, effect: EffectSource) {
|
||||
def applyBoost(s : Stat, boost : Int, effect: EffectSource)(implicit reader: SignalConsumer, rng: Random) {
|
||||
val modified = boosts.getOrElse(s, 0) + boost
|
||||
boosts = boosts.updated(s, Math.min(MaxBoost, Math.max(-MaxBoost, modified)))
|
||||
if (boost > 0) {
|
||||
println(s"$this's $s rose!")
|
||||
reader ! Message(s"$this's $s rose!")
|
||||
} else if (boost < 0) {
|
||||
println(s"$this's $s fell!")
|
||||
reader ! Message(s"$this's $s fell!")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ abstract class Move extends MoveTurn {
|
||||
}
|
||||
}
|
||||
|
||||
def applyBoosts(target: Monster, boosts: Map[Stat, Int], source: Monster) {
|
||||
def applyBoosts(target: Monster, boosts: Map[Stat, Int], source: Monster)(implicit read: SignalConsumer, rng: Random) {
|
||||
if (target.isAlive) {
|
||||
boosts.foreach {
|
||||
case (s, b) => {
|
||||
|
@ -19,7 +19,7 @@ object EffectType extends Enumeration {
|
||||
case "ability" => AbilityEffect
|
||||
case "item" => ItemEffect
|
||||
case "move" => MoveEffect
|
||||
case "status" => NonVolatile
|
||||
case "status" | "Status" | "nonvolatile" => NonVolatile
|
||||
case "volatile" => Volatile
|
||||
case "weather" => Weather
|
||||
case _ => default
|
||||
@ -49,14 +49,14 @@ class Status(template: StatusTemplate) extends Effect {
|
||||
// val id
|
||||
def effectType = template.effectType
|
||||
def onStart(mon: Monster, source: EffectSource)(implicit reader: SignalConsumer, rng: Random) = template.onStart(this, mon, source, reader, rng)
|
||||
def onEnd(mon: Monster) = template.onEnd(this, mon)
|
||||
def onEnd(mon: Monster)(implicit reader: SignalConsumer, rng: Random) = template.onEnd(this, mon, reader, rng)
|
||||
def onModifyStat(mon: Monster, stat: Stat) = template.onModifyStat(this, mon, stat)
|
||||
// val onBeforeMovePriority : Int
|
||||
def onBeforeMove(mon: Monster, move: MoveTurn, target: Monster)(implicit reader: SignalConsumer, rng: Random) = template.onBeforeMove(this, mon, move, target, reader, rng)
|
||||
// val onModifyMove
|
||||
// val onHit
|
||||
def onResidualOrder = template.onResidualOrder
|
||||
def onResidual(mon: Monster) = template.onResidual(this, mon)
|
||||
def onResidual(mon: Monster)(implicit reader: SignalConsumer, rng: Random) = template.onResidual(this, mon, reader, rng)
|
||||
// val onSwitchIn
|
||||
|
||||
val intData: MutMap[String, Int] = MutMap[String, Int]()
|
||||
@ -70,14 +70,14 @@ abstract class StatusTemplate {
|
||||
// val id
|
||||
val effectType: EffectType
|
||||
val onStart: (Status, Monster, EffectSource, SignalConsumer, Random) => Unit
|
||||
val onEnd: (Status, Monster) => Unit
|
||||
val onEnd: (Status, Monster, SignalConsumer, Random) => Unit
|
||||
val onModifyStat: (Status, Monster, Stat) => Fraction
|
||||
// val onBeforeMovePriority : Int
|
||||
val onBeforeMove: (Status, Monster, MoveTurn, Monster, SignalConsumer, Random) => Boolean
|
||||
// val onModifyMove
|
||||
// val onHit
|
||||
val onResidualOrder: Int
|
||||
val onResidual: (Status, Monster) => Unit
|
||||
val onResidual: (Status, Monster, SignalConsumer, Random) => Unit
|
||||
// val onSwitchIn
|
||||
|
||||
def build = new Status(this)
|
||||
@ -135,7 +135,7 @@ object Status {
|
||||
}
|
||||
"""
|
||||
|
||||
def compileOnStart(code: String): (Status, Monster, EffectSource, SignalConsumer, Random ) => Unit = {
|
||||
def compileOnStart(code: String): (Status, Monster, EffectSource, SignalConsumer, Random) => Unit = {
|
||||
if (code == null) {
|
||||
(_, _, _, _, _) => ()
|
||||
} else {
|
||||
@ -154,21 +154,22 @@ object Status {
|
||||
}
|
||||
}
|
||||
|
||||
def compileOnEnd(code: String): (Status, Monster) => Unit = {
|
||||
def compileOnEnd(code: String): (Status, Monster, SignalConsumer, Random) => Unit = {
|
||||
if (code == null) {
|
||||
(_, _) => ()
|
||||
(_, _, _, _) => ()
|
||||
} else {
|
||||
val tree = tb.parse(
|
||||
s"""
|
||||
|$header
|
||||
|def onStart(self:Status, mon: Monster) = {
|
||||
|def onStart(self:Status, mon: Monster, reader: SignalConsumer, rng: Random) = {
|
||||
| $helpers
|
||||
| $code
|
||||
|}
|
||||
onStart _
|
||||
""".stripMargin)
|
||||
val f = tb.compile(tree)
|
||||
val wrapper = f()
|
||||
wrapper.asInstanceOf[(Status, Monster) => Unit]
|
||||
wrapper.asInstanceOf[(Status, Monster, SignalConsumer, Random) => Unit]
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,14 +211,15 @@ object Status {
|
||||
}
|
||||
}
|
||||
|
||||
def compileOnResidual(code: String): (Status, Monster) => Unit = {
|
||||
def compileOnResidual(code: String): (Status, Monster, SignalConsumer, Random) => Unit = {
|
||||
if (code == null) {
|
||||
(_, _) => ()
|
||||
(_, _, _, _) => ()
|
||||
} else {
|
||||
val tree = tb.parse(
|
||||
s"""
|
||||
|$header
|
||||
|def onResidual(self: Status, mon: Monster) = {
|
||||
|def onResidual(self: Status, mon: Monster, reader: SignalConsumer, rng: Random) = {
|
||||
| $helpers
|
||||
| $code
|
||||
|}
|
||||
|onResidual _
|
||||
@ -225,7 +227,7 @@ object Status {
|
||||
val f = tb.compile(tree)
|
||||
val wrapper = f()
|
||||
|
||||
wrapper.asInstanceOf[(Status, Monster) => Unit]
|
||||
wrapper.asInstanceOf[(Status, Monster, SignalConsumer, Random) => Unit]
|
||||
}
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@ aftermath:
|
||||
onAfterDamage: |-
|
||||
if ((source != null) && (source != mon) && (move != null) && move.flags("contact") && !mon.isAlive) {
|
||||
trigger
|
||||
println(s"$source is damaged in the aftermath!")
|
||||
msg(s"$source is damaged in the aftermath!")
|
||||
source.takeDamage(source(Hp) / 4);
|
||||
}
|
||||
onAfterDamageOrder: 1
|
||||
@ -31,6 +31,7 @@ flamebody:
|
||||
onAfterDamage: |-
|
||||
if (move != null && move.flags("contact")) {
|
||||
if (rng.chance(3, 10)) {
|
||||
trigger
|
||||
source.addStatus(Status("brn"), EffectSource(mon, self))
|
||||
}
|
||||
}
|
||||
@ -59,7 +60,7 @@ innardsout:
|
||||
onAfterDamage: |-
|
||||
if (source != null && source != mon && move != null /* && move.effectType === 'Move'*/ && !mon.isAlive) {
|
||||
trigger
|
||||
println(s"$source is damaged in the aftermath!")
|
||||
msg(s"$source is damaged in the aftermath!")
|
||||
source.takeDamage(damage)//, source, target);
|
||||
}
|
||||
onAfterDamageOrder: 1
|
||||
@ -76,7 +77,7 @@ ironbarbs:
|
||||
onAfterDamage: |-
|
||||
if (source != null && source != mon && move != null && move.flags("contact")) {
|
||||
trigger
|
||||
println(s"Pointed barbs dug into $source!")
|
||||
msg(s"Pointed barbs dug into $source!")
|
||||
source.takeDamage(source(Hp) / 8)//, source, target)
|
||||
}
|
||||
onAfterDamageOrder: 1
|
||||
@ -90,6 +91,7 @@ poisonpoint:
|
||||
onAfterDamage: |-
|
||||
if (move != null && move.flags("contact")) {
|
||||
if (rng.chance(3, 10)) {
|
||||
trigger
|
||||
source.addStatus(Status("psn"), EffectSource(mon, self))
|
||||
}
|
||||
}
|
||||
@ -105,7 +107,7 @@ roughskin:
|
||||
onAfterDamage: |-
|
||||
if (source != null && source != mon && move != null && move.flags("contact")) {
|
||||
trigger
|
||||
println(s"$source is damaged by rough skin!")
|
||||
msg(s"$source is damaged by rough skin!")
|
||||
source.takeDamage(source(Hp) / 8)//, source, target)
|
||||
}
|
||||
onAfterDamageOrder: 1
|
||||
@ -131,6 +133,7 @@ static:
|
||||
onAfterDamage: |-
|
||||
if (move != null && move.flags("contact")) {
|
||||
if (rng.chance(3, 10)) {
|
||||
trigger
|
||||
source.addStatus(Status("par"), EffectSource(mon, self))
|
||||
}
|
||||
}
|
||||
@ -143,10 +146,8 @@ tanglinghair:
|
||||
num: 221
|
||||
onAfterDamage: |-
|
||||
if (move != null && move.flags("contact")) {
|
||||
//this.add('-ability', target, 'Tangling Hair');
|
||||
trigger
|
||||
source.applyBoost(Speed, -1, effect)
|
||||
//this.boost({'spe': -1}, source, target, null, true);
|
||||
}
|
||||
rating: 2.5
|
||||
shortDesc: Pokemon making contact with this Pokemon have their Speed lowered by
|
||||
@ -160,10 +161,8 @@ weakarmor:
|
||||
num: 133
|
||||
onAfterDamage: |-
|
||||
if (move.category == Physical) {
|
||||
//this.boost({'def': -1, 'spe': 2}, target, target);
|
||||
trigger
|
||||
mon.applyBoost(PDef, -1)
|
||||
trigger
|
||||
mon.applyBoost(Speed, +2)
|
||||
}
|
||||
rating: 1
|
||||
|
@ -10,24 +10,13 @@ brn:
|
||||
1.frac
|
||||
}
|
||||
onStart: |
|
||||
if (!source.isMove) {
|
||||
print(s"[${source.mon}'s ${source.effect}]")
|
||||
}
|
||||
msg(s"${mon} was burned!")
|
||||
/*
|
||||
if (sourceEffect && sourceEffect.id === 'flameorb') {
|
||||
target.status = Status('brn', '[from] 'item': Flame Orb');
|
||||
} else if (sourceEffect && sourceEffect.effectType === 'Ability') {
|
||||
target.status = Status('brn', '[from] 'ability': ' + sourceEffect.name, '[of] ' + source);
|
||||
} else {
|
||||
target.status = Status('brn');
|
||||
}*/
|
||||
onEnd: |
|
||||
println(s"${mon} was healed of its burn.")
|
||||
msg(s"${mon} was healed of its burn.")
|
||||
onResidualOrder: 9
|
||||
onResidual: |
|
||||
mon.takeDamage(mon(Hp) / 16);
|
||||
println(s"${mon} was hurt by its burn!")
|
||||
msg(s"${mon} was hurt by its burn!")
|
||||
|
||||
confusion:
|
||||
id: confusion
|
||||
@ -39,7 +28,7 @@ confusion:
|
||||
mon -= self
|
||||
true
|
||||
} else {
|
||||
println(s"${mon} is confused!")
|
||||
msg(s"${mon} is confused!")
|
||||
if (rng.chance(1, 3)) {
|
||||
// confusion damage
|
||||
val maxDmg = (2 * mon.level / 5 + 2) * 40 * mon(PAtk) / (mon(PDef) * 50) + 2
|
||||
@ -63,15 +52,9 @@ confusion:
|
||||
}));
|
||||
*/
|
||||
onBeforeMovePriority: 3
|
||||
onEnd: println(s"${mon} snapped out of its confusion.")
|
||||
onEnd: msg(s"${mon} snapped out of its confusion.")
|
||||
onStart: |-
|
||||
msg(s"${mon} was confused!")
|
||||
/*
|
||||
if (sourceEffect && sourceEffect.id === 'lockedmove') {
|
||||
this.add('-start', target, 'confusion', '[fatigue]');
|
||||
} else {
|
||||
this.add('-start', target, 'confusion');
|
||||
}*/
|
||||
self.intData("time") = rng.nextInt(2, 6);
|
||||
|
||||
par:
|
||||
@ -80,19 +63,9 @@ par:
|
||||
num: 0
|
||||
effectType: 'Status'
|
||||
onStart: |
|
||||
if (!source.isMove) {
|
||||
print(s"[${source.mon}'s ${source.effect}]")
|
||||
}
|
||||
println(s"${mon} was paralyzed!")
|
||||
/*
|
||||
if (sourceEffect && sourceEffect.effectType === 'Ability') {
|
||||
this.add('-status', target, 'par', '[from] ability: ' + sourceEffect.name, '[of] ' + source);
|
||||
} else {
|
||||
this.add('-status', target, 'par');
|
||||
}
|
||||
*/
|
||||
msg(s"${mon} was paralyzed!")
|
||||
onEnd: |
|
||||
println(s"${mon} is no longer paralyzed!")
|
||||
msg(s"${mon} is no longer paralyzed!")
|
||||
onModifyStat: |
|
||||
if (stat == Speed /* && !mon.hasAbility('quickfeet') */) {
|
||||
1 \\ 2
|
||||
@ -114,21 +87,12 @@ slp:
|
||||
num: 0
|
||||
effectType: 'Status'
|
||||
onStart: |
|
||||
println(s"${mon} fell asleep!")
|
||||
/*
|
||||
if (sourceEffect && sourceEffect.effectType === 'Ability') {
|
||||
this.add('-status', target, 'slp', '[from] ability: ' + sourceEffect.name, '[of] ' + source);
|
||||
} else if (sourceEffect && sourceEffect.effectType === 'Move') {
|
||||
this.add('-status', target, 'slp', '[from] move: ' + sourceEffect.name);
|
||||
} else {
|
||||
this.add('-status', target, 'slp');
|
||||
}
|
||||
*/
|
||||
msg(s"${mon} fell asleep!")
|
||||
// 1-3 turns
|
||||
self.intData("startTime") = rng.nextInt(2, 5)
|
||||
self.intData("time") = self.intData("startTime")
|
||||
onEnd: |
|
||||
println(s"${mon} woke up!")
|
||||
msg(s"${mon} woke up!")
|
||||
onBeforeMovePriority: 10
|
||||
onBeforeMove: |
|
||||
/*
|
||||
@ -141,7 +105,7 @@ slp:
|
||||
mon.cureStatus();
|
||||
true
|
||||
} else {
|
||||
println(s"${mon} is fast asleep.")
|
||||
msg(s"${mon} is fast asleep.")
|
||||
!move.flags("sleepUsable")
|
||||
}
|
||||
|
||||
@ -151,7 +115,7 @@ flinch:
|
||||
name: flinch
|
||||
num: 0
|
||||
onBeforeMove: |-
|
||||
println(s"${mon} flinched!")
|
||||
msg(s"${mon} flinched!")
|
||||
false
|
||||
onBeforeMovePriority: 8
|
||||
onResidualOrder: 13
|
||||
@ -168,7 +132,7 @@ frz:
|
||||
mon.cureStatus()
|
||||
true
|
||||
} else {
|
||||
println(s"${mon} is completely frozen!")
|
||||
msg(s"${mon} is completely frozen!")
|
||||
false
|
||||
}
|
||||
onBeforeMovePriority: 10
|
||||
@ -177,19 +141,9 @@ frz:
|
||||
target.cureStatus()
|
||||
}
|
||||
onStart: |-
|
||||
println(s"${mon} was frozen solid!")
|
||||
/*
|
||||
if (sourceEffect && sourceEffect.effectType === 'Ability') {
|
||||
target.status = Status('frz', '[from] 'ability': ' + sourceEffect.name, '[of] ' + source);
|
||||
} else {
|
||||
target.status = Status('frz');
|
||||
}
|
||||
if (target.template.species === 'Shaymin-Sky' && target.baseTemplate.baseSpecies === 'Shaymin') {
|
||||
target.formeChange('Shaymin', this.effect, true);
|
||||
}
|
||||
*/
|
||||
msg(s"${mon} was frozen solid!")
|
||||
onEnd: |-
|
||||
println(s"${mon} thawed out.")
|
||||
msg(s"${mon} thawed out.")
|
||||
onModifyMove: |
|
||||
if (move.flags("defrost")) {
|
||||
mon.cureStatus()
|
||||
@ -201,20 +155,13 @@ psn:
|
||||
num: 0
|
||||
effectType: 'Status'
|
||||
onStart: |
|
||||
println(s"${mon} was poisoned!")
|
||||
/*
|
||||
if (sourceEffect && sourceEffect.effectType === 'Ability') {
|
||||
this.add('-status', target, 'psn', '[from] ability: ' + sourceEffect.name, '[of] ' + source);
|
||||
} else {
|
||||
this.add('-status', target, 'psn');
|
||||
}
|
||||
*/
|
||||
msg(s"${mon} was poisoned!")
|
||||
oneEnd: |
|
||||
println(s"${mon} was cured of its poison.")
|
||||
msg(s"${mon} was cured of its poison.")
|
||||
onResidualOrder: 9
|
||||
onResidual: |
|
||||
mon.takeDamage(mon(Hp) / 8);
|
||||
println(s"${mon} was damaged by poison!")
|
||||
msg(s"${mon} was damaged by poison!")
|
||||
|
||||
tox:
|
||||
name: 'tox'
|
||||
@ -222,16 +169,8 @@ tox:
|
||||
num: 0
|
||||
effectType: 'Status'
|
||||
onStart: |
|
||||
println(s"${mon} was baddly poisoned!")
|
||||
msg(s"${mon} was baddly poisoned!")
|
||||
self.intData("stage") = 0;
|
||||
/*
|
||||
if (sourceEffect && sourceEffect.id === 'toxicorb') {
|
||||
this.add('-status', target, 'tox', '[from] item: Toxic Orb');
|
||||
} else if (sourceEffect && sourceEffect.effectType === 'Ability') {
|
||||
this.add('-status', target, 'tox', '[from] ability: ' + sourceEffect.name, '[of] ' + source);
|
||||
} else {
|
||||
this.add('-status', target, 'tox');
|
||||
}*/
|
||||
onSwitchIn: |
|
||||
this.effectData.stage = 0;
|
||||
onResidualOrder: 9
|
||||
@ -240,4 +179,4 @@ tox:
|
||||
self.intData("stage") += 1
|
||||
}
|
||||
mon.takeDamage(self.intData("stage") \\ 16 * mon(Hp));
|
||||
println(s"${mon} was damaged by poison!")
|
||||
msg(s"${mon} was damaged by poison!")
|
||||
|
@ -9,6 +9,8 @@ case class Fraction(val num : Int, val denom : Int) extends Ordered[Fraction] {
|
||||
override def compare(f : Fraction) : Int = {
|
||||
(num * f.denom) compare (f.num * denom)
|
||||
}
|
||||
|
||||
def toDouble = 1.0 * num / denom
|
||||
}
|
||||
|
||||
class IntFraction(val x : Int) extends AnyVal {
|
||||
|
Loading…
x
Reference in New Issue
Block a user