dragon_blade

Crates.iodragon_blade
lib.rsdragon_blade
version2.1.0
sourcesrc
created_at2023-07-20 00:16:10.161862
updated_at2023-07-25 18:47:57.633792
descriptionA transpiler from Rust to Overwatch Workshop
homepage
repository
max_upload_size
id920820
size178,184
DevX19 (DeveloperX19)

documentation

README

Dragon Blade

This library lets you write code for the Overwatch Workshop in rust.

Example Usage:

use dragon_blade::*;

bind_subroutines! {
    convert_to_healing;
}
bind_player_variables! {
    converted_damage: Number;
}

fn main() {
    let script = Script::new("Heal for damage dealt");
    script.add(Rule {
        name: "Heal for adaptive amoumt",
        event: SubroutineBody(Subroutine::convert_to_healing()),
        conditions: conditions([]),
        actions: || {
            let amount =
                (1.15 - EventPlayer.normalized_health()) * EventPlayer.converted_damage() * 4;
            EventPlayer.heal(Null, amount);
        },
    });
    script.add(Rule {
        name: "heal player when they deal damage",
        event: PlayerDealtDamage(Team::Team1, Everyone),
        conditions: conditions([EventPlayer.is_alive()]),
        actions: || {
            cf_abort_if(Victim.equal(EventPlayer));
            EventPlayer.converted_damage().set(EventDamage);
            Subroutine::convert_to_healing().call();
        },
    });
    let script = script.generate();
    script.write_to_file("script.txt");
    script.copy_to_clipboard();
}
Commit count: 0

cargo fmt