Skip to content

Commit

Permalink
pre EChar
Browse files Browse the repository at this point in the history
  • Loading branch information
Lamby777 committed Jun 15, 2024
1 parent a21dfde commit 344da00
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions pets-lib/src/battle/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ pub struct BattleIcon {

#[godot_api]
impl BattleIcon {
fn pchar_to_frame(pchar_id: &str) -> i32 {
match pchar_id {
fn pchar_to_frame(pchar: PChar) -> i32 {
match pchar {
PChar::ETHAN => 0,
PChar::TERRA => 1,
PChar::SIVA => 2,
Expand All @@ -57,15 +57,15 @@ impl BattleIcon {
PChar::FUZZY => 8,

_ => {
godot_warn!("PChar {} doesn't have a battle icon (yet). Defaulting to Ethan's icon.", pchar_id);
godot_warn!("PChar {} doesn't have a battle icon (yet). Defaulting to Ethan's icon.", pchar);
0
}
}
}

pub fn set_icon(&mut self, pchar_id: &str) {
pub fn set_icon(&mut self, pchar: PChar) {
let mut sprite = self.base().get_node_as::<Sprite2D>("Sprite2D");
sprite.set_frame(Self::pchar_to_frame(pchar_id));
sprite.set_frame(Self::pchar_to_frame(pchar));
}

fn process_movement(&mut self, delta: f64) {
Expand Down
6 changes: 3 additions & 3 deletions pets-lib/src/stats/autoload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl StatsInterface {
}

// #[func]
pub fn get_character(&self, ch: &str) -> CharData {
pub fn get_character(&self, ch: &PChar) -> CharData {
self.save
.chars
.get(ch)
Expand All @@ -46,7 +46,7 @@ impl StatsInterface {
}

/// Get the list of stat calculation functions for a given character
pub fn get_statcalc(&self, ch: &str) -> Rc<StatCalcList> {
pub fn get_statcalc(&self, ch: &PChar) -> Rc<StatCalcList> {
self.statcalcs
.get(ch)
.expect("key should be a valid PChar name")
Expand All @@ -63,7 +63,7 @@ macro_rules! impl_stat_getters_on_si {
concat_idents::concat_idents!(fn_name = natural_, $stat, _of {
/// Get the stat of a given character at a level,
/// not including equips or consumables
pub fn fn_name(&self, pchar: &str) -> IntegralStat {
pub fn fn_name(&self, pchar: PChar) -> IntegralStat {
// get character level
let ch = self.get_character(pchar);
let lvl = ch.level;
Expand Down

0 comments on commit 344da00

Please sign in to comment.