afxDamage.cpp
Engine/source/afx/ce/afxDamage.cpp
Public Defines
define
myOffset(field) (field, )
Public Functions
ConsoleDocClass(afxDamageData , "@brief A datablock that specifies <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">effect.\n\n</a>" "A Damage effect is useful <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> assigning damage with unusual timing that must be synchronized with other effects. They " "can be used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> deal direct damage, radius damage, and damage over time. Negative damage amounts can be used <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> " "healing effects." "\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">afxEffects\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">AFX\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Datablocks\n</a>" )
Detailed Description
Public Defines
myOffset(field) (field, )
Public Functions
ConsoleDocClass(afxDamageData , "@brief A datablock that specifies <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Damage <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">effect.\n\n</a>" "A Damage effect is useful <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> assigning damage with unusual timing that must be synchronized with other effects. They " "can be used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> deal direct damage, radius damage, and damage over time. Negative damage amounts can be used <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> " "healing effects." "\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">afxEffects\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">AFX\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Datablocks\n</a>" )
IMPLEMENT_CO_DATABLOCK_V1(afxDamageData )
1 2 3//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// 4// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames 5// Copyright (C) 2015 Faust Logic, Inc. 6// 7// Permission is hereby granted, free of charge, to any person obtaining a copy 8// of this software and associated documentation files (the "Software"), to 9// deal in the Software without restriction, including without limitation the 10// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 11// sell copies of the Software, and to permit persons to whom the Software is 12// furnished to do so, subject to the following conditions: 13// 14// The above copyright notice and this permission notice shall be included in 15// all copies or substantial portions of the Software. 16// 17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 23// IN THE SOFTWARE. 24// 25//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// 26 27#include "afx/arcaneFX.h" 28 29#include "console/consoleTypes.h" 30#include "core/stream/bitStream.h" 31 32#include "afx/ce/afxDamage.h" 33 34//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// 35// afxDamageData 36 37IMPLEMENT_CO_DATABLOCK_V1(afxDamageData); 38 39ConsoleDocClass( afxDamageData, 40 "@brief A datablock that specifies a Damage effect.\n\n" 41 42 "A Damage effect is useful for assigning damage with unusual timing that must be synchronized with other effects. They " 43 "can be used to deal direct damage, radius damage, and damage over time. Negative damage amounts can be used for " 44 "healing effects." 45 "\n\n" 46 47 "@ingroup afxEffects\n" 48 "@ingroup AFX\n" 49 "@ingroup Datablocks\n" 50); 51 52afxDamageData::afxDamageData() 53{ 54 label = ST_NULLSTRING; 55 flavor = ST_NULLSTRING; 56 amount = 0; 57 repeats = 1; 58 ad_amount = 0; 59 radius = 0; 60 impulse = 0; 61} 62 63afxDamageData::afxDamageData(const afxDamageData& other, bool temp_clone) : GameBaseData(other, temp_clone) 64{ 65 label = other.label; 66 flavor = other.flavor; 67 amount = other.amount; 68 repeats = other.repeats; 69 ad_amount = other.ad_amount; 70 radius = other.radius; 71 impulse = other.impulse; 72} 73 74#define myOffset(field) Offset(field, afxDamageData) 75 76void afxDamageData::initPersistFields() 77{ 78 addField("label", TypeString, myOffset(label), 79 "An arbitrary string which is passed as an argument to a spell's onDamage() script " 80 "method. It can be used to identify which damage effect the damage came from in " 81 "cases where more than one damage effect is used in a single spell."); 82 addField("flavor", TypeString, myOffset(flavor), 83 "An arbitrary string which is passed as an argument to a spell's onDamage() script " 84 "method. It is used to classify a type of damage such as 'melee', 'magical', or " 85 "'fire'."); 86 addField("directDamage", TypeF32, myOffset(amount), 87 "An amount of direct damage to inflict on a target."); 88 addField("directDamageRepeats", TypeS8, myOffset(repeats), 89 "The number of times to inflict the damage specified by directDamage. Values " 90 "greater than 1 inflict damage over time, with the amount of directDamage " 91 "repeatedly dealt at evenly spaced intervals over the lifetime of the effect."); 92 addField("areaDamage", TypeF32, myOffset(ad_amount), 93 "An amount of area damage to inflict on a target. Objects within half the radius " 94 "receive full damage which then diminishes out to the full distance of " 95 "areaDamageRadius."); 96 addField("areaDamageRadius", TypeF32, myOffset(radius), 97 "Radius centered at the effect position in which damage will be applied."); 98 addField("areaDamageImpulse", TypeF32, myOffset(impulse), 99 "Specifies an amount of force to apply to damaged objects. Objects within half the " 100 "radius receive full impulse which then diminishes out to the full distance of " 101 "areaDamageRadius."); 102 103 Parent::initPersistFields(); 104} 105 106bool afxDamageData::onAdd() 107{ 108 if (Parent::onAdd() == false) 109 return false; 110 111 return true; 112} 113 114void afxDamageData::packData(BitStream* stream) 115{ 116 Parent::packData(stream); 117 118 stream->writeString(label); 119 stream->writeString(flavor); 120 stream->write(amount); 121 stream->write(repeats); 122 stream->write(ad_amount); 123 stream->write(radius); 124 stream->write(impulse); 125} 126 127void afxDamageData::unpackData(BitStream* stream) 128{ 129 Parent::unpackData(stream); 130 131 label = stream->readSTString(); 132 flavor = stream->readSTString(); 133 stream->read(&amount); 134 stream->read(&repeats); 135 stream->read(&ad_amount); 136 stream->read(&radius); 137 stream->read(&impulse); 138} 139 140 141//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// 142