[Question]
  [
[Dungeon Master](https://en.wikipedia.org/wiki/Dungeon_Master_(video_game)) was one of the first ever real-time role-playing games, originally released in 1987 on the Atari ST. Among other exciting things for the time, it offered a rather sophisticated spell system based on runes.
Your task today is to write a program or function that evaluates the number of Mana points required to cast a given spell in Dungeon Master.
[![Dungeon Master screenshot](https://i.stack.imgur.com/sVeHw.gif)](https://i.stack.imgur.com/sVeHw.gif)
*The 'spell cast' system is the top right cyan box in the above picture.*
## Spells, runes and Mana
Dungeon Master spells are composed of 2 to 4 runes, picked among the following categories, in this exact order:
1. Power (mandatory)
2. Elemental Influence (mandatory)
3. Form (optional)
4. Class / Alignment (optional)
It means that valid spells are either:
* Power + Elemental Influence
* Power + Elemental Influence + Form
* Power + Elemental Influence + Form + Class / Alignment
Each category contains 6 runes, and each rune has an associated base Mana cost:
```
=============================================================================
| Power               | Rune      |   Lo |   Um |   On |   Ee |  Pal |  Mon |
|                     +-----------+------+------+------+------+------+------+
|                     | Base cost |    1 |    2 |    3 |    4 |    5 |    6 |
=============================================================================
| Elemental Influence | Rune      |   Ya |   Vi |   Oh |  Ful |  Des |   Zo |
|                     +-----------+------+------+------+------+------+------+
|                     | Base cost |    2 |    3 |    4 |    5 |    6 |    7 |
=============================================================================
| Form                | Rune      |  Ven |   Ew | Kath |   Ir |  Bro |  Gor |
|                     +-----------+------+------+------+------+------+------+
|                     | Base cost |    4 |    5 |    6 |    7 |    7 |    9 |
=============================================================================
| Class / Alignment   | Rune      |   Ku |  Ros | Dain | Neta |   Ra |  Sar |
|                     +-----------+------+------+------+------+------+------+
|                     | Base cost |    2 |    2 |    3 |    4 |    6 |    7 |
=============================================================================
```
## Evaluating the Mana cost
The Mana cost of the spell is the sum of the Mana cost of all runes:
* The cost of the Power rune always equals its base cost (from 1 to 6).
* For the other runes, the following formula applies:
[![cost = floor( (power + 1) * base_cost / 2 )](https://i.stack.imgur.com/JkdRu.png)](https://i.stack.imgur.com/JkdRu.png)
where ***power*** is the base cost of the Power rune.
## Examples
```
Spell: Lo Ful
Cost : 1 + floor((1 + 1) * 5 / 2) = 1 + 5 = 6
Spell: Um Ful
Cost : 2 + floor((2 + 1) * 5 / 2) = 2 + 7 = 9
Spell: Pal Vi Bro
Cost : 5 + floor((5 + 1) * 3 / 2) + floor((5 + 1) * 7 / 2) = 5 + 9 + 21 = 35
```
## Clarifications and rules
* Your input will consist of 2 to 4 strings designating the runes of the spell. You can take them in any reasonable format, such as 4 distinct parameters, an array of strings (e.g. `['Lo', 'Ful']`), or just one string with a single-character separator of your choice (e.g. `'Lo Ful'`). Please specify the selected input format in your answer.
* The runes are guaranteed to be valid.
* The order of the categories must be respected. Unused categories may be either missing or replaced with some falsy value.
* You can accept the runes in any of these formats: 1. A capital letter followed by lower case (`'Ful'`) 2. All lower case (`'ful'`) 3. All upper case (`'FUL'`). But you *can't* mix different formats.
* Quite obviously, we do not care to know whether the spell actually has some effect in the game (for the curious, [useful spells are listed here](http://dmweb.free.fr/?q=node/195).)
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest code in bytes wins.
* And remember: [Lord Chaos](http://www.mobygames.com/game/dos/dungeon-master/screenshots/gameShotId,9756/) is watching you!
## Test cases
```
Spell          | Output
---------------+-------
Lo Ful         | 6
Um Ful         | 9
On Ya          | 7
Lo Zo Ven      | 12
Pal Vi Bro     | 35
Ee Ya Bro Ros  | 31
On Ful Bro Ku  | 31
Lo Zo Kath Ra  | 20
On Oh Ew Sar   | 35
Ee Oh Gor Dain | 43
Mon Zo Ir Neta | 68
Mon Des Ir Sar | 75
```
  
[Answer]
# [Python 2](https://docs.python.org/2/), ~~135~~ ~~119~~ 115 bytes
```
b=[int('27169735 2  4567 435262'[int(x,36)%141%83%50%23])for x in input()]
print b[0]+sum(a*-~b[0]/2for a in b[1:])
```
[Try it online!](https://tio.run/##XU7bSsNAEH3PVwyBsIlWbDY3LfRFWkWqVryBhjxs6koC6W7YJjR98dfjzrYkIAxzOefMmakPTSEF7Tfym89t2@7zeVqKxiU08ePrJIiAAoRRnEAYRDSmxLDdJIg9xw995ypwoqlDg8z7kQo6KIWOum1cL7NqpbWQp9PsfNduXXZ28YvDJUUpQ2me@rPM6/Vda1@UFYc31fKZBcA7vgH8qScPkkyA3LYVscj7duzXAvtPptuj5MvkDy408swqM5SYb5TU0JKf9CdElxe5G4zQdGRW7T/bFWsKs8KGjbUBlnvMr0wNJ474nVRYFqzEfx6lGL3uDfPEGzYyC74bKXT7Aw "Python 2 – Try It Online")
Input is list of strings from stdin
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~83~~ 82 bytes
```
.•Y<εΔ•¹нk©.•M₄Pç•²нkÌ.•Jrû •³нkD(i\ë4 3‡4+}.•A1Δ#•I4èkD(i\ë3LJ012‡Ì})ćsv®>y*;(î(+
```
[Try it online!](https://tio.run/##MzBNTDJM/f9f71HDokibc1vPTQEyDu28sDf70EqQmO@jppaAw8tBgpuAgod7QIJeRYd3K4CENgOFXDQyYw6vNlEwftSw0ES7FiTvaHhuijKQ9jQ5vAIqb@zjZWBoBFRyuKdW80h7cdmhdXaVWtYah9dpaP//X5rLlVaaw5WdWJLBlZdakggA "05AB1E – Try It Online")
-1 thanks to [Emigna](https://codegolf.stackexchange.com/users/47066/emigna).
SOOOOOOO ungolfed :(
Explanation:
```
.•Y<εΔ•¹нk©.•M₄Pç•²нkÌ.•Jrû •³нkD(i\ë4 3‡4+}.•A1Δ#•I4èkD(i\ë3LJ012‡Ì})ćsv®>y*;(î(+ Accepts four runes as separate lines, lowercase. Use Ø for missing runes.
.•Y<εΔ•¹нk©                                                                        Index first letter of first rune into "aluoepm" ("a" makes 1-indexed)
           .•M₄Pç•²нkÌ                                                             Index first letter of second rune into "yvofdz", 2-indexed.
                      .•Jrû •³нkD(i\ë4 3‡4+}                                       Index first letter of third rune into "vekibg", 0-indexed, if it's not there pop, else, if index is 4 replace with 3, else keep as-is, then increment by 4.
                                            .•A1Δ#•I4èkD(i\ë3LJ012‡Ì}              Index fourth letter (modular wrapping) of fourth rune into "kodnra", if it's not there pop, else, if index is one of 1, 2 or 3, replace with 0, 1 or 2 respectively, else keep as-is, then increment by 2.
                                                                     )ćs           Wrap all numbers into a list, keeping the power rune behind.
                                                                        v          For each
                                                                         ®>y*;(î(   Apply the formula
                                                                                 +  Add to total sum
```
[Answer]
# JavaScript (ES6), ~~157~~ ~~156~~ ~~116~~ ~~112~~ ~~100~~ ~~99~~ 97 bytes
Takes input as an array of strings.
```
a=>a.map(c=>t+=(v=+`27169735020045670435262`[parseInt(c,36)%141%83%50%23],+a?a*v+v>>1:a=v),t=0)|t
```
* Saved a massive 44 bytes by borrowing the indexing trick from [ovs' Python solution](https://codegolf.stackexchange.com/a/129033/58974) - if you're upvoting this answer, please upvote that one too.
* Saved 13 bytes thanks to [Arnauld](https://codegolf.stackexchange.com/users/58563/arnauld) pointing out what should have been an obvious opportunity to use a ternary.
[Try it Online!](https://tio.run/##VZBva8IwEMa/ylEotEst/WPrNkgHm26I2xzKhE2FHjXOSk1KE7s3/e5dqiLsXiTP89z9DpI91iizKi9Vj4sNa7e0RZqge8DSymiiCLVqStJg4Md3gzDyAs/rR/HA64dREAfpssRKsjFXVuaEsW36fd@8Dc3IM4Nw7RB8wJua1Eni3yOtbUdRz25UmwkuRcHcQvxY6bxkRQHXauBJSLXivf9FTueKp2RpvAp4PhaGY3weLmLK4Qv1rTvfAhaMa/2BBSxyeKyENiOmBzoNMyHPgCZPweR4BSeodjDDc3@6g9EvzLE649q@iAqGmHfL3wTvgHEF70zhJRgy2SUdsj59oKSJdEvcjPjG8iObGA0YZGtJV5ZFrlJIbdvdi5yn@l12@wc)
---
## Explanation
Hoo, boy, this is gonna be fun - my explanations to *trivial* solutions suck at the best of times! Let's give it a go ...
```
a=>
```
An anonymous function taking the array as an argument via parameter `a`.
```
a.reduce((t,c)=>,0)
```
Reduce the elements in the array by passing each through a function; the `t` parameter is the running total, the `c` parameter is the current string and `0` is the initial value of `t`.
```
parseInt(c,36)
```
Convert the current element from a base 36 string to a decimal integer.
```
%141%83%50%23
```
Perform a few modulo operations on it.
```
+`27169735 2  4567 435262`[]
```
Grab the character from the string at that index and convert it to a number.
```
v=
```
Assign that number to variable `v`.
```
+a?
```
Check if variable `a` is a number. For the first element `a` will be the array of strings, trying to convert that to a number will return `NaN`, which is falsey. On each subsequent pass, `a` will be a positive integer, which is truthy.
```
a*v+v>>1
```
If `a` is a number then we multiply it by the value of `v`, add the value of `v` and shift the bits of the result 1 bit to the right, which gives the same result as dividing by 2 and flooring.
```
:a=v
```
If `a` is not a number the we assign the value of `v` to it, which will also give us a `0` to add to our total on the first pass.
```
t+
```
Finally, we add the result from the ternary above to our running total.
---
## Original, 156 bytes
```
a=>a.reduce((t,c)=>t+(p+1)*g(c)/2|0,p=(g=e=>+`123456234567456779223467`["LoUmOnEePaMoYaViOhFuDeZoVeEwKaIrBrGoKuRoDaNeRaSa".search(e[0]+e[1])/2])(a.shift()))
```
[Answer]
# [SOGL V0.12](https://github.com/dzaima/SOGL), ~~110~~ 78 [bytes](https://github.com/dzaima/SOGL/blob/master/chartable.md)
```
θKKι"LUOEPM”;W:A≤{B"⁶Μ↓§QΕņj“L─"¶Ζq«╝γDyΜ2¶S◄Μ$‘č¹I6nēwι{_Cb:ƧRA=┌*ΚKι=?aIc*»+
```
[Try it Here!](https://dzaima.github.io/SOGLOnline/?code=JXUwM0I4S0sldTAzQjklMjJMVU9FUE0ldTIwMUQlM0JXJTNBQSV1MjI2NCU3QkIlMjIldTIwNzYldTAzOUMldTIxOTMlQTdRJXUwMzk1JXUwMTQ2aiV1MjAxQ0wldTI1MDAlMjIlQjYldTAzOTZxJUFCJXUyNTVEJXUwM0IzRHkldTAzOUMyJUI2UyV1MjVDNCV1MDM5QyUyNCV1MjAxOCV1MDEwRCVCOUk2biV1MDExM3cldTAzQjklN0JfQ2IlM0EldTAxQTdSQSUzRCV1MjUwQyoldTAzOUFLJXUwM0I5JTNEJTNGYUljKiVCQis_,inputs=TW9uJTIwWm8lMjBJciUyME5ldGE_)
Could probably golf a byte or two from redoing everything
Explanation:
```
θ            split on spaces
 K           pop the 1st item
  K          pop from the string the 1st character
   ι         remove the original string from stack
    "”;W     get the chars index in "LUOEPM"
        :A   save a copy to variable A
          ≤  put the power (used as the mana) on the bottom of the stack (with the thing above being the input array)
{            for the leftover items in the input do
 B             save the current name on B
  "..“         push 456779223467234567
      L─       base-10 decode it (yes, silly, but it converts it to an array of digits)
        ".‘    push "VEKIBGKRDN-SYVOFDZ"
               
      č        chop to characters
       ¹       create an array of those two
        I      rotate clockwise
         6n    group to an array with sub-arrays of length 6 (so each array in the array contains 3 items, corresponding to the categories, each with 6 arrays with the runes 1st letter (or "-" in the case of Ra) and base cost)
           ē   push variable e (default = user input number, which errors and defaults to 0) and after that increase it (aka `e++`)
            w  get that item in the array (the array is 1-indexed and the variable is not, so the array was created shifted (which somehow saves 0.9 ≈ 1 byte in the compression))
 ι             remove the original array
  {            for each in that (current category) array
   _             dump all contents on stack (so pushing the runes name and then base cost)
    C            save pop (base cost) on variable B
     b:          duplicate the name
       ƧRA=      push if pop = "RA"
           ┌*    get that many (so 0 or 1) dashes
             Κ   prepend the "" or "-" to the name
              K  pop the 1st letter of the name
               ι remove the modified name, leaving the 1st letter on the stack
         =?      if top 2 are equal (one of the dumped items and the 1st letter of the current inputs)
           a       push variable A (the power)
            I      increase it
             c     push variable C (the current base cost)
              *    multiply
               »   floor-divide by 2
                +  add that to the power
```
[Answer]
# JavaScript, ~~212~~ ~~210~~ ~~207~~ 206 bytes
Straight-forward searching algorithm, the search strings are just contributing to the total bytes.
**Code**
```
s=>eval('p=q=+(e=s.map(r=>"1 2 3 4 5  6  2 3 4 5  6  7 4  5 6   7 7  9  2 2  3   4   6 7"["LoUmOnEePalMonYaViOhFulDesZoVenEwKathIrBroGorKuRosDainNetaRaSar".search(r)])).shift();e.map(c=>p+=((q+1)*c)>>1);p')
```
**Input Format**
String array, each item is a first-letter-capitalized string. Example: ["Mon", "Zo", "Ir", "Neta"]
**Explanation**
```
e=s.map(r=>"1 2 3 4 5  6  2 3 4 5  6  7 4  5 6   7 7  9  2 2  3   4   6 7"["LoUmOnEePalMonYaViOhFulDesZoVenEwKathIrBroGorKuRosDainNetaRaSar".search(r)])
```
This queries for the basic costs.
```
p=q=+(/*blah*/).shift() 
```
Initializes 2 variables with the first item from the array result above, and remove that item. Must be cast to number first, otherwise it will be considered as string concatenation in the next part.
```
e.map(c=>p+=((q+1)*c)>>1);
```
Adds the costs of the non-power runes to the base power. Shifting is used instead of floor(blah)/2.
```
eval(/*blah*/;p)
```
Evaluate the last result. (Credit: Step Hen)
**Test Cases**
```
Lo Ful | 6
Um Ful | 9
On Ya | 7
Lo Zo Ven | 12
Pal Vi Bro | 35
Ee Ya Bro Ros | 31
On Ful Bro Ku | 31
Lo Zo Kath Ra | 20
On Oh Ew Sar | 35
Ee Oh Gor Dain | 43
Mon Zo Ir Neta | 68
Mon Des Ir Sar | 75
```
Edit 1: 212 > 210 - Removed a pair of braces
Edit 2: 210 > 207 - Thanks **Step Hen** for reminder on JS rules and some hint on using eval() function. Since AS3 forbids the use of eval() I haven't use that for long time
Edit 3: 207 > 206 - Thanks **Shaggy** for the idea replacing indexOf() with search()
[Answer]
# [Haskell](https://www.haskell.org/), 159 156 148 133 130 127 bytes
```
k(p:y)=sum$floor<$>c p:map(\x->c x*(c p+1)/2)y
c s=read["3764529516342767"!!(foldl(\c n->c*94+fromEnum n-9)0s%7086%17)]
(%)=mod
```
[Try it online!](https://tio.run/##XZFhb4IwEIa/8ytOokmrmAkiCJF9WHSLcc5FM5NNzUIEpxEoacvUX88OIdHsW@95eu81170vjmEU5fmRpO6FeiKL67uIMT6oP24hdWM/JetzG8/nJkHQ0umDQS/KFoTHQz9YqV3bMnuG09OtrmnYlq3WamTHoiAi6y0k2Nl0zNaOs3iUZDECh3ZEw@70rYZu041CGtSLWZDLUEgBrgsrspD8kPxoME4kXiiFpwAa9ZXBcxapGlgUgUbUj7gCTgVmCXz6WNtVjR1fDJZhgkw3KvjuR7A8wBNnSLu9io5CbC0gzJkohH7LxCFXM8nuRRk@8eUe5sVQo3PrmO1hdIKFz/@NQP7COAz9Q/Eks1uZKUuKrDGHt1AWWVb/zgxDUagyzb6mbRQlxoxiZeMZEFpWHuCPTb8hxRVKqEPA8CoRGvxSGLThukwkPJQZT0oBngdHICfGAwGC0vwP "Haskell – Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), ~~320 318 314 311~~ 307 bytes
**Input Format -** List of Strings. Full program:
```
i=input()
t=[x.split()for x in"Lo Um On Ee Pal Mon|Ya Vi Oh Ful Des Zo|Ven Ew Kath Ir Bro Gor|Ku Ros Dain Neta Ra Sar".split('|')]
c=t[0].index(i[0])+1;r=c+1;s=c+r*(t[1].index(i[1])+2)/2
if len(i)>2:s+=r*(t[2].index(i[2])+4-(i[2]=='Bro'))/2
if len(i)>3:s+=r*(t[3].index(i[3])+1+(i[3]in'KuRaSar'))/2
print(s)
```
**[Try it online!](https://tio.run/##ZVLBTsMwDL33K6xe0jIYrOM0FA5oA00dFA2YtFU7RF2mRuqSKk21IvXfh5NNtIiLY/v52e5zy2@TKxmdMrXj1Pf9k6BClrUJQs/QtBlWZSEw2CsNDQjpLxR8HSCRMOPwzgp4VbJdM1gJSHJ4rguY8go2ql1xLDlCzEwOcw1PWsGL0m1cw1JVMGVCwhs3DJYMPpj2L3NIS8Ktl1GT3m2HQu54Ewh0w8HoQdMMbYVWXwUmHXX4CPEovI08sYeCy0CEj9GkGlBXF3V1Edbd3ziHUoIbkfAva/zLGnessZ0@cI6QJK6XDPc9M0stpAmq8IS6ed4xFwWHT13zCW94FlhFw1NKFopcA0FpyNZLydehHyXSRmvmgnPhxlmUz@VQYhcKa@3KNjnjF9Ylhw@K2mto23dYXP9rb8/iaKzHSlxqdrTWfmM36ozg/exjb@cwPH3Xce4we9I@hj9DB7qePw "Python 2 – Try It Online")**
[Answer]
# Excel, 339 bytes
Inputs entered in `A1` through `D1`. Formula in any other cell.
```
=CHOOSE(MOD(CODE(A1),12),2,,,1,6,,3,5,4)+INT((CHOOSE(MOD(CODE(A1),12),2,,,1,6,,3,5,4)+1)*CHOOSE(MOD(CODE(B1),12),,3,,,2,7,4,6,,5)/2)+INT((CHOOSE(MOD(CODE(A1),12),2,,,1,6,,3,5,4)+1)*CHOOSE(MOD(CODE(C1),12),7,4,6,,,7,,,5,,9)/2)+INT((CHOOSE(MOD(CODE(A1),12),2,,,1,6,,3,5,4)+1)*CHOOSE(MOD(CODE(SUBSTITUTE(D1,"Ra","E")),11),4,3,6,,2,7,,,2,0)/2)
```
Alternatively, importing as CSV:
## Excel & CSV, 228 bytes
```
,,,
=CHOOSE(MOD(CODE(A1),12),2,,,1,6,,3,5,4)+1
=A2-1+INT(A2*CHOOSE(MOD(CODE(B1),12),,3,,,2,7,4,6,,5)/2)+INT(A2*CHOOSE(MOD(CODE(C1),12),7,4,6,,,7,,,5,,9)/2)+INT(A2*CHOOSE(MOD(CODE(SUBSTITUTE(D1,"Ra","E")),11),4,3,6,,2,7,,,2,0)/2)
```
Input entered in first row, `SPACE` for nulls. Result displayed in A3.
[Answer]
# SCALA, 1106 chars, 1106 bytes
This is quite long, probably optimizable, but it was fun to do :)
**Input format** : space-separated runes in a string. If there is only 2 inputs (like "Lo Ful") my code completes it with `while(k.length<4)k:+=""` (so I can save **24 bytes** by changing the parameters, if I require it to be "A B C D").
```
def n(i:Int,p:String):Int={Math.floor(i*((""+p(0)).toInt+1)/2).toInt}
def m(s:String):Int={var k=s.split(' ')
```
**`while(k.length<4)k:+=""`**
```
k match{case Array(p,i,f,a)=>{p match{case "Lo"=>1+m(1+"/ "+i+" "+f+" "+a)
case "Um"=>2+m(2+"/ "+i+" "+f+" "+a)
case "On"=>3+m(3+"/ "+i+" "+f+" "+a)
case "Ee"=>4+m(4+"/ "+i+" "+f+" "+a)
case "Pal"=>5+m(5+"/ "+i+" "+f+" "+a)
case "Mon"=>6+m(6+"/ "+i+" "+f+" "+a)
case _ if p.contains("/")=>i match{case "Ya"=>n(2,p)+m(p+" / "+f+" "+a)
case "Vi"=>n(3,p)+m(p+" / "+f+" "+a)
case "Oh"=>n(4,p)+m(p+" / "+f+" "+a)
case "Ful"=>n(5,p)+m(p+" / "+f+" "+a)
case "Des"=>n(6,p)+m(p+" / "+f+" "+a)
case "Zo"=>n(7,p)+m(p+" / "+f+" "+a)
case _ if p.contains("/")=>f match{case "Ven"=>n(4,p)+m(p+" / "+"/ "+a)
case "Ew"=>n(5,p)+m(p+" / "+"/ "+a)
case "Kath"=>n(6,p)+m(p+" / "+"/ "+a)
case "Ir"=>n(7,p)+m(p+" / "+"/ "+a)
case "Bro"=>n(7,p)+m(p+" / "+"/ "+a)
case "Gor"=>n(9,p)+m(p+" / "+"/ "+a)
case _ if p.contains("/")=>a match{case "Ku"=>n(2,p)
case "Ros"=>n(2,p)
case "Dain"=>n(3,p)
case "Neta"=>n(4,p)
case "Ra"=>n(6,p)
case "Sar"=>n(7,p)
case _=>0}
case _=>0}
case _=>0}
case _=>0}}}}
```
Thanks for this superb challenge. [Try it online!](https://tio.run/##hZRdb5swFIavx6@wfFMzsqT5nBaNSJ2aTVGWZWrVSO3N5KWmeAHbAmfZFOW3Z8eEElwY5QLh18/59DHpmkb0KH/@YmuNFpQLxP5oJh5TdKXU/vjIAiQIH8@EbqnxrU64eHLNyt8vqA7bQSRlQvhbQjD2FLl03baWsO113U4v/z44xktMUtv@N03Qxk/bqYq4JhfownV2IY8Y2bQjJp50@HHgbsaej7GzQTHV63C/pilDV0lC/xLV4q2gRV1/slflXfxVYn/S9WLS9XAHYY97GN5B9qauc4LuYoB6APUaoKUAqA9QvwGaMoAGAA0aoO80AmoI1LCBWkgTcATU6P/UD8QDpNprKTQcVkpwB0MPuNWCewp@BOm1lAvOFNh3qtFWPIP6jdAyzKBBI/R5G2XUsJG6ZmlGjRqpB5lB75ug@hYEVgtWTNRlnrX1fHa7urxtZg5TXpe3Tc2SurRt5lMiX4e@yJOnDw1Qff3Uqn@@LUYg93wj05fSNZgXQ5Br35imReeeTWnRgVy5peeC86T8yeXh1U94jm8U/AR0JAhcVQSzg95NoLj4eYld1zkjd7GFnJY2shTonhZEtrIB8PsgEUxEOdJJsUG4pmjFERxUQZ4lG50yE9SQ0NeCttRKlqYQszfflrM9q3VZm/FDN/RF5rlaibAM0XSH4HDKAQqxUgHswLwhMwblEkqybQI/KBN9liAzJYWJLVdN4OabzXJatmxMnMPxHw)
[Answer]
# [Shakespeare Programming Language](https://github.com/TryItOnline/spl), 4420 bytes
```
,.Ajax,.Ford,.Page,.Puck,.Romeo,.Act I:.Scene I:.[Enter Romeo and Page]Page:You big big big big big big cat.[Exit Romeo][Enter Ajax]Page:Open thy mind!Ajax:Open thy mind!Open thy mind!You is the sum of Romeo and the sum of a big big cat and a cat.Am I as big as you?If not,let us return to Scene V.Page:You is the sum of a big big cat and a cat.Let us return to Act V.Scene V:.Ajax:You is the sum of you and the sum of a big big big cat and a pig.Am I as big as you?If not,let us return to Scene X.Page:You big cat.Let us return to Act V.Scene X:.Ajax:You is the sum of you and the sum of a big cat and a cat.Am I as big as you?If not,let us return to Scene L.Page:You big big cat.Let us return to Act V.Scene L:.Ajax:You is the sum of you and the sum of a big big cat and a big cat.Am I as big as you?If not,let us return to Scene C.Page:You is the sum of a big cat and a cat.Let us return to Act V.Scene C:.Ajax:Am I as big as the sum of you and a big big big pig?Page:You is the sum of a big big cat and a big cat.If so,you is the sum of you and a cat.Ajax:Open thy mind!Act V:.Scene I:.[Exit Ajax][Enter Ford]Page:Open thy mind!Ford:Open thy mind!Open thy mind!You is the sum of Romeo and the sum of a big big big big cat and a pig.Am I as big as you?If not,let us return to Scene V.Page:You big big cat.Let us return to Act X.Scene V:.Ford:You is the sum of you and the sum of a big big big cat and a pig.Am I as big as you?If not,let us return to Scene X.Page:You is the sum of a big cat and a cat.Let us return to Act X.Scene X:.Ford:You is the sum of you and a big big cat.Am I as big as you?If not,let us return to Scene L.Page:You is the sum of a big big big cat and a pig.Let us return to Act X.Scene L:.Ford:Am I as big as the sum of you and a pig?If not,let us return to Scene C.Page:You big cat.Let us return to Act X.Scene C:.Ford:Am I as big as the sum of Romeo and a big big cat?Page:You is the sum of a big big cat and a cat.If so,you is the sum of you and a cat.Ford:Open thy mind!Act X:.Scene I:.[Exit Page][Enter Puck]Ford:You is the sum of the sum of Ajax and a pig and the quotient between the product of Ajax and I and a big cat.Puck:Open thy mind!Is you as big as a pig?If so,let us return to Act D.[Exit Puck][Enter Page]Ford:Open thy mind!Open thy mind!You is the sum of Romeo and the sum of a big big cat and a cat.Am I as big as you?If not,let us return to Scene V.Page:You is the sum of a big big cat and a cat.Let us return to Act L.Scene V:.Ford:Am I as big as the sum of you and a big big cat?If not,let us return to Scene X.Page:You is the sum of a big big big cat and a pig.Let us return to Act L.Scene X:.Ford:Open thy mind!Am I as big as the sum of Romeo and a big cat?If not,let us return to Scene L.Page:You is the sum of a big big big cat and a pig.Let us return to Act L.Scene L:.Ford:You is the sum of Romeo and the sum of a big big big cat and a pig.Am I as big as you?If not,let us return to Scene C.Page:You is the sum of a big big big cat and a cat.Let us return to Act L.Scene C:.Ford:Am I as big as the sum of you and a big big cat?If so,let us return to Scene D.Page:You big big cat.Let us return to Act L.Scene D:.Page:Open thy mind!You is the sum of a big big cat and a big cat.Act L:.Scene I:.[Exit Page][Enter Puck]Ford:You is the sum of you and the quotient between the product of Ajax and I and a big cat.Puck:Open thy mind!Is you as big as a pig?If so,let us return to Act D.[Exit Puck][Enter Page]Ford:You is the sum of Romeo and a big big cat.Am I as big as you?If not,let us return to Scene V.Page:You is the sum of a big cat and a cat.Let us return to Act C.Scene V:.Ford:You is the sum of you and the sum of a big big big cat and a pig.Am I as big as you?If not,let us return to Scene X.Page:You big cat.Let us return to Act C.Scene X:.Ford:Am I as big as the sum of you and the sum of a big cat and a cat?If not,let us return to Scene L.Page:You big big cat.Let us return to Act C.Scene L:.Ford:Am I as big as the sum of you and a big big big cat?If not,let us return to Scene C.Page:You is the sum of a big big big cat and a pig.Let us return to Act C.Scene C:.Page:Open thy mind!Is you as big as the sum of Romeo and a cat?You big cat.If so,you is the sum of you and a big big cat.Act C:.Scene I:.[Exit Page][Enter Puck]Ford:You is the sum of you and the quotient between the product of Ajax and I and a big cat.Act D:.Scene I:.Ford:Open thy heart![Exeunt]
```
Takes the input as an uppercase string.
Explanation coming soon... For now, **Fun fact:** `Microsoft` is a negative noun in SPL. All other accepted words appeared in the works of Shakespeare.
[Try it online!](https://tio.run/##zVfbbqMwEP2V6TvyB@QlikhXQmK3VSKhrKo80MRNaROcBaM2X5/1GAjYXA1IzUMSsGXPOeNzZpz4fLxeLbL48L8t8otFe4s8@wcqvpPdp0VW7ESZmN5xcGZkvaMhxYeXx5DTCOQs@OEecM0Wv2Z/WQKvwaH2s/O5WPod8HTlNtsGg6eLn840BP5@gVMQ7h9wXBtS3zBWEIt3CnFyAvZWQlQa9MsA5KQvoSxO4IAfyxnxc2HJ3HmDkHHrSDkkMUSUJ5GIxyBl7pEbRTVsUwRX3wcT6WV59GYy7TXbCSTNHNQo5@BgzmNDlKPqRLoxRzoy0y6piKkTpTssnwXSPIoxWrtdFwaasDMOGoQaLqoghAzmBtrMmQpaMbMujQnLTq/qQ4lZKQjoamnkzNRYS@pMjePTmnoiU3gGktsUFpZ8ftTCAyW3KczdwUFR0CgvNymzmpBWyG4GuY9L0Bm93dvr0O3O6IVgldTNDbtHP3fWGEqirbhT9ujMndjdtw3HXnpEQxd5vAn6X8J4QEMOr5R/URmZwjli@0QELi9ztHqDYTWsTpzyueXxdmSC@7HuHJY5H@SQ80Fu05eWu7gvuFqxMekNqLpRhcTAna5WUDRN9nZLN2Z3csxuYxHs0XxGlnLblE2nUuzhSqkzXbrp0qA/5kCWM1JzBTC7o8j9Bhezch@@57LVJryR/dcbfVWw7@m60yo8W6tB3Q5oz8eEf1PsAZcXLYNTF5LGsmgXhaTGvxXtN6gWEZdPrPs@o@gccfys76VtSxDUtvZO/Yg/CFg0Cfn2ev399AeWj2twVrBerP4D "Shakespeare Programming Language – Try It Online")
[Answer]
# [Java (OpenJDK 8)](http://openjdk.java.net/), 252 bytes
```
r->{int c[][]={{2,3,4,5,6,7},{4,5,6,7,7,9},{2,2,3,4,6,7}},l=r.length,p="LUOEPM".indexOf(r[0].charAt(0))+1,a=p,i=0;String[]s={"YVOFDZ","VEKIBG","KRDNXS"};for(;i<l-1;)a+=(p+1)*c[i][s[i++].indexOf((l>3?r[i].replace("Ra","X"):r[i]).charAt(0))]/2;return a;}
```
[Try it online!](https://tio.run/##bZNtT@owGIa/n1/xpAnJdlbGm8KROYwGNAZ0BpSoyz70jCL1zG5pO4@G8Ns53QsIeLYvbZ9rz333bvdK3kk1Tih/nf1ZJ@nviIUQRkRKuCGMw/IHgFRE6dVXTdqpYpE9T3moWMzt@/iaq8tydjpRgvEXP@jB3F2Lam/JuILQD/zAXS6buIWP8DFu484KL8uRfk/0rImLalZb4cgVdkT5i1rgxEWjB29wd4Nsxmf0w5sbwq8Hdrgg4lwZddO0Gpi4CWZu3dnIS3eJnqbeZf8ZYTQdDK8vrvRgOO7fPk7QypnHwnDYaVRtOCaxXCOxGubP0GeBL31mWcFWyYh6rTOhC7agSURCaqAx0Z0ekdnNls0dG0Gt6QiqUsGBOKs1gKNzK9Ms43uP2QzedKbGxigQ8SLNPGIARaUy0CiGyzRCGLZP23SgVoNR42gHe3g7xE5MZ6fucXgiu2Xo7NW1zHMMU8q3TKO5B9yRCKYMLkS8IVrHe8CAaoWsDuNY5kyrcWhBW8yJYfo/oPAwJGoB48Jrs37YwVvA4C9MiChcfPeggatYQF/HmiFHrT3gJuaZxrWAW6pyjfavb0CfyowoRTqFxOrr2ufnluPFuYFIOZUYsstNPxIaKjrbHGK2JqjOzoW5TZIk@jyX@g8x8k9smURMiwIySxOTT6nomx2nyk50azU3UKVZl1DtQaU160JFVrJtlYJZY7yVBNctpM4AeUPUBXTr3YM3BC1gfVGWVkPlllaZ5vof "Java (OpenJDK 8) – Try It Online")
The runes are input as a `String[]` (array of `String`), in the first case form (first letter is an uppercase, rest is lowercase).
It's the standard "find the n-th letter" method, with the twist that both `Ros` and `Ra` exist in the 4th segment. I treated that with an inline and explicit replacement of `Ra` to `X`.
[Answer]
# [Retina](https://github.com/m-ender/retina), ~~124~~ 123 bytes
```
Gor
9
[ZIBS]\w+
7
Mon|Des|Kath|Ra
6
..l|Ew
5
Ee|Oh|Ven|Neta
4
[OVD]\w+
3
[UYKR]\w+
2
Lo
1
\d
$*
(?<=^(1+) .*1)
$1
\G1
11
11
```
[Try it online!](https://tio.run/##LU9da8JAEHyfX7EPClEhcPaLQqUgSYPENiViQGPFAw8SSO/gjOTl/nu6dxQWdmd3hp2xqm@1HKdRdhkzY/GK@rhZ735OwwIv@DTaJermctk3rpR4Rhx3Lh3whFS5onGV0u5L9RKPqIsqCbIH1PtDXoZ5ia2BwOmKyRzR@9vqHInFjOK5mGHC@0xA@BrHraGPe4f9b2iFpoNkLR0N8Q98y46qltbW8GM@@YlKc/NE5geY3/8F3i2xW74VDaUD7aT1MgYckRLZap/MUzeWgn0POajHTP4D "Retina – Try It Online") Link includes test cases. Takes space-separated runes. Explanation: The initial stages simply convert each rune to a digit, which is then converted to unary. The numbers after the first are multiplied by one more than the first number, following which the first number is doubled. The final stage integer divides all the result by 2 and takes the sum.
[Answer]
# Go, 205 bytes
```
func c(s []string)int{f,l:=strings.IndexByte,len(s)
p:=f("UOEPM",s[0][0])+3
r:=p-1+p*(f("VOFDZ",s[1][0])+3)/2
if l>2{r+=p*(f("war o",s[2][1])+5)/2}
if l>3{r+=p*(f("it Ra",s[3][len(s[3])-2])+3)/2}
return r}
```
It's a callable function, takes runes as a slice of strings, e.g. `[]string{"Um", "Ful"}`.
Try it on the [Go Playground](https://play.golang.org/p/P-GC7ucMCg).
[Answer]
# C, 222
**Thanks to @ceilingcat for some very nice pieces of golfing - now even shorter**
```
i;b(r,s)char**r;{for(i=17;i--&&"& ; $ # 4 %        ; B * 6 $ 8          6 5 - >3  +  A@( .   6 5    "[s*17+i]-3-(*r[s]^r[s][1]););return~i?i/2+1:0;}main(n,r)int**r;{n=b(++r,0);printf("%d\n",n-(b(r,1)+b(r,2)+b(r,3))*~n/2);}
```
[Try it online!](https://tio.run/##PY7LTsMwEEV/5SrQyGPHtE6gRYzKo1/Aik0IUhoojAQumpQVan/dJFBxFvdKZ3U6/9p1KQmvjRY9dW@tWqv8vdmqkWVYsHif51kOxilOcI4JjjBWsJgP@hL/zHEBj@sKcMDdrcHZUQ5kdW/DwknjK2@s1n3zNE4dGmJifdl9aTzIjUxLF65mvP9oJZpYKEnc/TbF5do4p8WM@FMHuTHZ5PkxZkX0ZswP5MYr/64isoc4LYn3KaX79j09SFrpNv0A "C (gcc) – Try It Online")
A more ungolfed version of my original answer:
```
#include<stdio.h>
char*a="& ; $ # 4 %      "
       "  ; B * 6 $ 8    "
       "      6 5 - >3  +"
       "  A@( .   6 5    ";
int b(char*r,int s){
  for(int i=0;i<17;i++)
    if(a[i+s]-3==(r[0]^r[1]))
      return i/2+1;
  return 0;
}
#define c(p,r,i)(p+1)*b(r[i+1],i*17)/2
int main(int n,char**r){
  int x=b(r[1],0);
  printf("%d\n",x+c(x,r,1)+c(x,r,2)+c(x,r,3));
}
```
You need to supply four command line arguments - so for the first test case you need to run `./a.out Lo Ful "" ""`
[Answer]
## Haskell, 623 bytes
Using ADTs instead of numerical voodoo.
**NOTE: Add 36 for `{-# LANGUAGE GADTs,ViewPatterns #-}`**
* Score is computed assuming that it is compiled/run with `-XGADTs -XViewPatterns`
```
data P=Lo|Um|On|Ee|Pal|Mon deriving(Enum,Read,Eq)
data E=Ya|Vi|Oh|Ful|Des|Zo deriving(Enum,Read,Eq)
data F=Ven|Ew|Kath|Ir|Bro|Gor deriving(Enum,Read,Eq)
data C=Ku|Ros|Dain|Neta|Ra|Sar deriving(Enum,Read,Eq)
data S where
  S::P->E->S
  Q::P->E->F->S
  R::P->E->F->C->S
k(a:b:x)=let{p=read a;e=read b}in case x of{[]->S p e;[c]->Q p e(read c);[c,d]->R p e(read c)(read d)}
c,d::Enum a=>a->Int
c=succ.fromEnum
d=(+2).fromEnum
e Bro=7
e x=(+2).d$x
f x|c x`elem`[1,5,6]=d x|2>1=c x
g p f x =(`div`2).(*f x).succ$c p
h(S x y)=c x+g x d y
h(Q x y z)=h(S x y)+g x e z
h(R x y z t)=h(Q x y z)+g x f t
main=print.h.k.words=<<getLine
```
Input: a single spell as a normal string
e.g.  
`Lo Ful`
`Um Ful`
Multilining can be done by replacing the last line with
```
main=interact$unlines.map(show.h.k.words).lines
```
But this would add bytes to the count
]