Skip to content

Commit

Permalink
botw-ability-unstable plugin (#163)
Browse files Browse the repository at this point in the history
* implmement fury gale plugin

* add fury/gale plugin

* fix multiplier not considered for first cooldown and not considered in error message

* disable zoom when nothing is loaded

* run fmt
  • Loading branch information
Pistonight authored Nov 18, 2023
1 parent 2a4f7f9 commit ec8210b
Show file tree
Hide file tree
Showing 7 changed files with 434 additions and 17 deletions.
12 changes: 12 additions & 0 deletions compiler-core/src/json/coerce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ pub trait Coerce {
/// Interpret a number or string as u64
fn try_coerce_to_u64(&self) -> Option<u64>;

/// Interpret a number or string as u32
fn try_coerce_to_u32(&self) -> Option<u32>;

/// Interpret a number or string as i64
fn try_coerce_to_i64(&self) -> Option<i64>;

Expand Down Expand Up @@ -87,6 +90,15 @@ impl Coerce for Value {
}
}

fn try_coerce_to_u32(&self) -> Option<u32> {
let x = self.try_coerce_to_u64()?;
if x > u32::MAX as u64 {
None
} else {
Some(x as u32)
}
}

fn try_coerce_to_i64(&self) -> Option<i64> {
match self {
Value::Number(n) => n.as_i64(),
Expand Down
Loading

0 comments on commit ec8210b

Please sign in to comment.