mirror of
https://github.com/redstrate/Kawari.git
synced 2025-04-23 15:47:45 +00:00
Create EffectKind enum to hold the different effect kinds
This commit is contained in:
parent
3d128c8fab
commit
7f75a378f4
4 changed files with 19 additions and 10 deletions
|
@ -13,9 +13,9 @@ use kawari::packet::{
|
|||
send_packet,
|
||||
};
|
||||
use kawari::world::ipc::{
|
||||
ActionEffect, ActionResult, ClientZoneIpcData, CommonSpawn, DisplayFlag, GameMasterCommandType,
|
||||
GameMasterRank, ObjectKind, OnlineStatus, PlayerSubKind, ServerZoneIpcData,
|
||||
ServerZoneIpcSegment, SocialListRequestType,
|
||||
ActionEffect, ActionResult, ClientZoneIpcData, CommonSpawn, DisplayFlag, EffectKind,
|
||||
GameMasterCommandType, GameMasterRank, ObjectKind, OnlineStatus, PlayerSubKind,
|
||||
ServerZoneIpcData, ServerZoneIpcSegment, SocialListRequestType,
|
||||
};
|
||||
use kawari::world::{
|
||||
ChatHandler, Inventory, Zone, ZoneConnection,
|
||||
|
@ -824,11 +824,10 @@ async fn main() {
|
|||
connection.get_actor(request.target.object_id)
|
||||
{
|
||||
for effect in &effects_builder.effects {
|
||||
match effect.action_type {
|
||||
3 => {
|
||||
match effect.kind {
|
||||
EffectKind::Damage => {
|
||||
actor.hp -= effect.value as u32;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,11 +2,19 @@ use binrw::binrw;
|
|||
|
||||
use crate::common::{ObjectTypeId, read_quantized_rotation, write_quantized_rotation};
|
||||
|
||||
#[binrw]
|
||||
#[derive(Debug, Eq, PartialEq, Clone, Copy, Default)]
|
||||
#[brw(repr = u8)]
|
||||
pub enum EffectKind {
|
||||
#[default]
|
||||
Damage = 3,
|
||||
}
|
||||
|
||||
#[binrw]
|
||||
#[brw(little)]
|
||||
#[derive(Debug, Clone, Copy, Default)]
|
||||
pub struct ActionEffect {
|
||||
pub action_type: u8,
|
||||
pub kind: EffectKind,
|
||||
pub param0: u8,
|
||||
pub param1: u8,
|
||||
pub param2: u8,
|
||||
|
|
|
@ -60,7 +60,7 @@ mod event_start;
|
|||
pub use event_start::EventStart;
|
||||
|
||||
mod action_result;
|
||||
pub use action_result::{ActionEffect, ActionResult};
|
||||
pub use action_result::{ActionEffect, ActionResult, EffectKind};
|
||||
|
||||
use crate::common::Position;
|
||||
use crate::common::read_string;
|
||||
|
|
|
@ -8,7 +8,9 @@ use crate::{
|
|||
|
||||
use super::{
|
||||
PlayerData, StatusEffects, Zone,
|
||||
ipc::{ActionEffect, ActorSetPos, EventPlay, ServerZoneIpcData, ServerZoneIpcSegment},
|
||||
ipc::{
|
||||
ActionEffect, ActorSetPos, EffectKind, EventPlay, ServerZoneIpcData, ServerZoneIpcSegment,
|
||||
},
|
||||
};
|
||||
|
||||
pub struct ChangeTerritoryTask {
|
||||
|
@ -171,7 +173,7 @@ impl UserData for EffectsBuilder {
|
|||
fn add_methods<M: UserDataMethods<Self>>(methods: &mut M) {
|
||||
methods.add_method_mut("damage", |_, this, amount: u16| {
|
||||
this.effects.push(ActionEffect {
|
||||
action_type: 3,
|
||||
kind: EffectKind::Damage,
|
||||
value: amount,
|
||||
param1: 133,
|
||||
..Default::default()
|
||||
|
|
Loading…
Add table
Reference in a new issue