| 315 | |
| 316 | |
| 317 | bool ApplyActiveDefense(OsiArgumentDesc & args) |
| 318 | { |
| 319 | auto characterGuid = args[0].String; |
| 320 | auto statusId = args[1].String; |
| 321 | auto lifeTime = args[2].Float; |
| 322 | |
| 323 | auto character = FindCharacterByNameGuid(characterGuid); |
| 324 | if (character == nullptr) { |
| 325 | OsiError("Character " << characterGuid << " does not exist!"); |
| 326 | return false; |
| 327 | } |
| 328 | |
| 329 | auto statusMachine = character->StatusMachine; |
| 330 | if (!statusMachine) { |
| 331 | OsiError("Character has no StatusMachine!"); |
| 332 | return false; |
| 333 | } |
| 334 | |
| 335 | auto applyStatus = gOsirisProxy->GetLibraryManager().StatusMachineApplyStatus; |
| 336 | if (applyStatus == nullptr) { |
| 337 | OsiError("esv::StatusMachine::ApplyStatus not found!"); |
| 338 | return false; |
| 339 | } |
| 340 | |
| 341 | auto status = ConstructStatus<esv::StatusActiveDefense>(statusMachine, statusId, StatusType::ActiveDefense); |
| 342 | if (status == nullptr) { |
| 343 | return false; |
| 344 | } |
| 345 | |
| 346 | if (lifeTime < 0.0f) { |
| 347 | status->Flags0 |= SF0_KeepAlive; |
| 348 | status->CurrentLifeTime = 1.0f; |
| 349 | } else { |
| 350 | status->Flags0 |= SF0_IsLifeTimeSet; |
| 351 | status->LifeTime = lifeTime; |
| 352 | status->CurrentLifeTime = lifeTime; |
| 353 | } |
| 354 | |
| 355 | ObjectHandle handle; |
| 356 | character->GetObjectHandle(&handle); |
| 357 | |
| 358 | status->TargetHandle = handle; |
| 359 | status->TargetPos = *character->GetTranslate(); |
| 360 | |
| 361 | applyStatus(statusMachine, status); |
| 362 | args[3].Int64 = (int64_t)status->StatusHandle; |
| 363 | return true; |
| 364 | } |
| 365 | |
| 366 | |
| 367 | bool ApplyDamageOnMove(OsiArgumentDesc & args) |
nothing calls this directly
no test coverage detected