1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
unit = DC.constants.level.unit_by_id(spellargs.unitid)

unit.skills.Add(autohash("Spellcasting"), 0.0006, unit)

if spellargs.targetclass == "Tear"
 if !DC.constants.is_client
  tear = DC.constants.level.item_by_id spellargs.targetid
  if DC.IsNotNull tear and tear.GetSubType == 1 # Natures
   newtree = DC::ObjectRegister.Get autohash("Tree")
   chunk = DC.constants.level.th.TileChunkAt tear.GetPos
   DC.constants.level.RemoveItem tear.GetID
  
   
    objupdate = DC.ObjectUpdateEvent_New
    objupdate.AddUpdate newtree
    chunk.trees.Push newtree
    DC.constants.server.ResonateEvent objupdate
   
  
  elsif tear.GetSubType == 2 # Arcane
   DC.SpawnElemental(DC.constants.level, tear.GetPos)
   remevent = DC.RemovEntityEvent_New
   remevent.ID.push_back tear.GetID   
   DC.constants.server.ResonateEvent remevent
   DC.constants.level.RemoveItem tear.GetID
  end
 end
elsif spellargs.isweapon
 targetitem = DC.constants.level.item_by_id spellargs.targetid
 targetitem.enchants.AddEnchant DC::ObjectRegister.GetEffect(autohash "DamageEnchant")
elsif spellargs.isarmor
 targetitem = DC.constants.level.item_by_id spellargs.targetid
 targetitem.enchants.AddEnchant DC::ObjectRegister.GetEffect(autohash "ArmorEnchant")
elsif spellargs.targetclass == "Tool"
 targetitem = DC.constants.level.item_by_id spellargs.targetid
 targetitem.enchants.AddEnchant DC::ObjectRegister.GetEffect(autohash "Power")
end